June 20, 2013

Post: Why MySQL could be slow with large tables ?

…, which means if single query execution time is your concern many hard drives and large number of CPUs will not help… 1% or rows or less full table scan may be faster. Avoid joins to large tables Joining of large data sets using nested loops is very expensive. Try to avoid it. Joins to smaller tables is…

Post: Joining on range? Wrong!

… is a tiny store directory consisting of three very simple tables: CREATE TABLE `products` ( `prd_id` int(10) unsigned NOT NULL AUTO… be to figure out how many LCD TVs were sold yesterday. SELECT COUNT(1) FROM tags t JOIN products p ON p… relevant rows. This affects joins only. When you use a range condition on the first (or the only) table, it works as…

Post: MySQL EXPLAIN limits and errors.

….0 with addition of greedy join the problem on looking at too many table join combinations in joins with very large tables is elevated, however there… rows estimated from each row in a join and multiply them to see how many rows will be examined in total. This… it would not tell you if temporary table will be required on disk. In many cases it is impossible to tell as…

Post: Moving Subtrees in Closure Table Hierarchies

… of D, or many other common queries that are difficult if you store hierarchies according to textbook solutions. CREATE TABLE TreePaths ( ancestor….descendant, supertree.length+subtree.length+1 FROM TreePaths AS supertree JOIN TreePaths AS subtree WHERE subtree.ancestor = ‘D’ AND supertree.descendant…

Post: Using Multiple Key Caches for MyISAM Scalability

…. Table Locks are not the issue for Read Only workload and write intensive workloads can be dealt with by using with many tables… information_schema.table_statistics ts join information_schema.tables t on t.table_name=ts.table_name and t.table_schema=ts.table_schema where t.table_schema… information_schema.table_statistics ts join information_schema.tables t on t.table_name=ts.table_name and t.table_schema=ts.table_schema where t.table_schema…

Post: How well does your table fits in innodb buffer pool ?

… index_id) bp JOIN innodb_sys_indexes ON id = index_id JOIN innodb_sys_tables ON table_id = innodb_sys_tables.id JOIN innodb_index_stats ON innodb_index_stats.table_name = innodb_sys_tables.name AND…) This query shows information about how many pages are in buffer pool for given table (cnt), how many of them are dirty (dirty…

Post: How fast is FLUSH TABLES WITH READ LOCK?

… take an extremely long time on production systems, measured in many minutes, or potentially even hours. And during this time, the… t1 join t t2 join t t3 join t t4 where t1.b=0 | | 5 | root | localhost | test | Query | 62 | Flushing tables | flush tables with… tables” is a misnomer — connection 5 is not flushing tables yet. It’s waiting to get the lock. Flushing tables After the FLUSH TABLES

Post: Database problems in MySQL/PHP Applications

… would rather do many to many relationship between users and tables but it also might work. Regarding if you use many tables you’re doing… with many tables some are OS and File System dependent, others correspond to Innodb storage engine or using innodb_file_per_table option… your data however it does not always bring good performance. Joins are expensive and you can often do much better with…

Post: MySQL VIEW as performance troublemaker

… as with subqueries and derived tables MySQL 5.0 will fail and perform very inefficiently in many counts. MySQL has two ways… use more then one Temporary Tables views which you join together you may have serious issues because such tables do not get any… we get 2 derived tables in which case which are fully populated and “full join” used to to join between them. In this…

Post: Using delayed JOIN to optimize count(*) and LIMIT queries

In many Search/Browse applications you would see main (fact) table which contains search fields and dimension tables which contain more information about facts and which need to be joined to get… for such result sets MySQL will perform the join even if you use LEFT JOIN so it is not needed which slows…