MySQL Forums
Forum List  »  Optimizer & Parser

Re: How to optimize an ORDER BY query using a range to avoid any filesorts
Posted by: KimSeong Loh
Date: October 14, 2007 05:44PM

Not possible in this case, because you are searching for a set of values, the results are no longer sorted by the 2nd column in the index.

It only works if you search for a single value of db_id using =
Example, try this, this will not have filesort
SELECT
series_id, weight
from series_main
WHERE
series_main.db_id = 1
order by weight
limit 5000;

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.