MySQL Forums
Forum List  »  Optimizer & Parser

Re: two column int index not used correctly
Posted by: Jørgen Løland
Date: June 15, 2011 07:14AM

Hi Ming,

In the first query, the range is known at query optimization time (you specified it as constants) and MySQL figures out that range access is the best way to read this range.

In the second query, the range is not known at query optimization time. Moreover, the range will be different for each row in table_main. MySQL cannot use range access for such queries.

Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle

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.