June 18, 2013

Post: Is it query which needs to be optimized ?

… are couple of examples: GROUP BY Consider SELECT COUNT(*) cnt, page FROM log GROUP BY page ORDER BY cnt DESC limit 10, the query… as possible. ORDER BY I already wrote about ORDER BY LIMIT Optimization so I will not repeat it here. In the nutshell ORDER BY LIMIT can be… make sure for queries you’re going to run ORDER BY .. LIMIT can be performed using the index, for example simple JOIN is…

Post: MySQL Performance - eliminating ORDER BY function

… rules you would learn about MySQL Performance Optimization is to avoid using functions when comparing constants or order by. Ie use indexed_col=N… you look only at ORDER BY clause you would see first query which sorts by function is able to avoid order by while second which… this case MySQL Optimizer is rather smart and is able to do this even if we have function in ORDER BY and exactly…

Post: Goal driven performance optimization

performance optimization potential. But let us get back to the Server Side Optimization. Lets assume our performanceoptimize something, my checklist is usually get rid of it, cache it, tune it, get more hardware in this order…and it becomes 90% or so driven by Sphinx. This tells us there is some…

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

… with MySQL Optimizer I frequently run into is making poor decision when it comes to choosing between using index for ORDER BY or… there are also bunch of fields which sorting can be performed on such as seller, price, date added etc. Such configuration… * from goods where cat_id=5 and seller_id=1 order by price desc limit 10 \G *************************** 1. row *************************** id: 1 select…

Post: Sphinx search performance optimization: attribute-based filters

…it defaults to 20. Total says 1000 because by default query is limited to 1000 best …I would emphasize – while it is a neat performance optimization for highly selective attributes, this is certainly … search and then filtering, using attribute is orders of magnitude better than using a fulltext key…

Post: Join Optimizations in MySQL 5.6 and MariaDB 5.5

… this optimization actually is. Key-ordered Scan for BKA With this optimization the idea of MRR is further extended to improve join performance. As… col1 would be sorted by col1 i.e. in index order and then the lookup will be performed. So key-ordered scan is basically…_shippriority order by revenue desc, o_orderdate LIMIT 10; In-memory workload Now let’s see how effective are the join optimizations when…

Post: MySQL Indexing Best Practices: Webinar Questions Followup

…. That would clearly save indexing space. Is this a reasonable performance optimization. (Keep in mind that the prefix adaptive hashing would fail… collation specific. Q: ORDER By optimization issues: select * from table where A=xxx and B between 100 and 200 order by B Very common for…

Post: The Optimization That (Often) Isn't: Index Merge Intersection

performance win, perhaps. Sometimes it is. Other times, it is a major performance…AND parent_id=0 AND status=1 ORDER BY user_id LIMIT 1\G *************************** 1. row ***************************…that they can always outsmart the optimizer by manually manipulating indexes in every query…

Post: Full table scan vs full index scan performance

…EXPLAIN as Extra: Using index) is a very interesting performance optimization, a full index scan (type: index) is according to…. Let’s see how the optimizer will execute it: mysql> EXPLAIN SELECT * FROM employees ORDER BY first_name\G *************************** 1. row *************************** id:…

Post: Extending Index for Innodb tables can hurt performance in a surprising way

… * from idxitest where a=100 order by id desc limit 1; +—-+————-+———-+——+—————+——+———+——-+——+——————————————+ | id | select_type …ordering of data by primary key inside indexes they can become significantly affected. Optimizer