On Wed, Jun 22, 2011 at 10:04:11AM -0500, Dan McGee wrote:
We were doing some silly things here with an "ORDER BY Name, CategoryID" clause, due to the fact that Name is unique, and thus any additional ordering after Name will have no effect. Of course, the dumb as a box of rocks MySQL query optimizer doesn't realize this, leading to full table scans every time of ~30000 packages instead of using index scans for the ordering and only retrieving the first 50 rows.
The biggest change is noted in the default sort order as it cuts down the columns to one, but we can remove the redundant sort from other orderings as well, even though those will still not be able to use an index-driven query plan.
Signed-off-by: Dan McGee <dan@archlinux.org> ---
This will directly address 2 of the top 5 queries in the sigurd MySQL slow query log.
Ack, thanks.