May 25, 2012

Comment: Multi Column indexes vs Index Merge

…in 3.8 secs. I dont understand why MySQL uses index merge after a couple of … OR LinksTbl2.converted_from_id=0) ORDER BY LinksTbl2.tstamp DESC, LinksTbl2.id DESC LIMIT…| const | PRIMARY,namespace_ix | PRIMARY | 4 | const | 1 | Using filesort | | 1 | SIMPLE | LinksTbl2 | index_merge | tstamp,userid,…

Post: Multi Range Read (MRR) in MySQL 5.6 and MariaDB 5.5

by c_custkey, c_name, c_acctbal, c_phone, n_name, c_address, c_comment order by revenue desc LIMIT…bound workload, mentioned above. Counter Name MySQL 5.5 MySQL 5.6 MySQL 5.6 w/ read_rnd_…ordered scan; Using temporary; Using filesort 1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3.orders

Comment: What does Using filesort mean in MySQL?

… SELECT * FROM table1 ORDER BY a LIMIT 1698, 1 This one uses filesort (Extra: Using filesort): EXPLAIN SELECT * FROM table1 ORDER BY a LIMIT 1699, 1 Can someone EXPLAIN if there is a rule that MySQL uses to determine whether to use index or filesort

Post: ORDER BY ... LIMIT Performance Optimization

…cause of MySQL Performance problems. Here is what you need to know about ORDER BYLIMIT optimization to avoid these problems ORDER BY with LIMIT is most…going to use in ORDER BY in other table. Here is example when ORDER BY is done by second table which requires filesort: mysql> explain select …

Post: Possible optimization for sort_merge and UNION ORDER BY LIMIT

…,c2); Using where; Using filesort 1 row in set (0.00 sec) As you can see MySQL 5.1.21 uses sort… ORDER BY ORD LIMIT 10 to individual queries. What if we do int manually ? mysql> explain (select * from utest where c1=5 order by ord desc limit 10) union (select * from utest where c2=5 order by ord desc limit 10) order by

Post: Using index for ORDER BY vs restricting number of rows.

…_id`,`seller_id` ) mysql> explain select * from goods where cat_id=5 and seller_id=1 order by price desc limit 10 \G *************************** 1… sec) mysql> explain select * from goods force index(cat_id) where cat_id=5 and seller_id=1 order by price desc limit 10… million of rows to analyze but we got rid of filesort so MySQL can stop as soon as 10 rows are sent…

Post: Using GROUP BY WITH ROLLUP for Reporting Performance Optimization

… run two queries: mysql> select grp, count(*) cnt from dt where slack like “a%” group by grp order by cnt desc limit 10; +——+—–+ | grp | cnt… fast it is without order by (and limit): mysql> select grp, count(*) cnt from dt where slack like “a%” group by grp with rollup; +——-+———+ | grp… GROUP BY WITH ROLLUP is slower and why ORDER BY does not work with it. The thing is – it is using filesort as group by

Post: MySQL: Followup on UNION for query optimization, Query profiling

… as IN filesort appears and query becomes very slow: mysql> explain select * from people where age=18 order by last_online desc limit 10; +—-+————-+——–+——+—————+——+———+——-+——-+————-+ | id… use UNION to avoid filesort of full table: mysql> explain (select * from people where age=18 order by last_online desc limit 10) UNION ALL…

Post: Is it query which needs to be optimized ?

… summary table. With MySQL 5.0 it is also easy to implement one by use of triggers. … ORDER BY I already wrote about ORDER BY LIMIT Optimization so I will not repeat it here. In the nutshell ORDER BY LIMITfilesort, and it does not take many of such queries to overload server. Also watch high limit

Post: Identifying the load with the help of pt-query-digest and Percona Server

…: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # InnoDB…by MySQL. The end result might be that you end up limiting the number of results returned by the query, by using a LIMIT clause or by… ‘post_format’) AND tr.object_id IN (733) ORDER BY t.name ASC\G Let’s again take…