MySQL Forums
Forum List  »  Optimizer & Parser

Re: How to optimize an ORDER BY query using a range to avoid any filesorts
Posted by: Faury Rodriguez
Date: October 24, 2007 02:27PM

Actually, yeah it is not using a filesort, and it is much faster, but I don't understand the output of the explain.

Weight is 3 bytes and db_id is 1 byte, so according to key_len it's using the full key, however, the # of rows is all the rows in the table (which makes sense because it's getting that from the weight portion) vs. just the # of rows that matches my db_id range, which should have been ~1.9 million.

But doesn't this mean it won't scale well? Let's say I have 10 million rows, but my db_id range only matches 2 million. Will it really do a index scan of the entire table of 10 million or stop when it has looked at all the db_ids in my range.

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.