MySQL Forums
Forum List  »  Optimizer & Parser

Re: inner join on range criteria: unable to use index?
Posted by: KimSeong Loh
Date: August 12, 2008 07:11PM

Correct, no table scanning necessary

but if you also have
...
3 1
3 2
3 3
3 4
4 1
4 2
4 3
4 4
and many more bigger values

You will need to go further down to get 3 1 , 3 2 and then to 4 and so on.

2 issues here, if you are searching a huge percentage of the data from the index, this can actually be slower than doing a full table scan, due to random IO and sequential IO.

2nd issue, the composite index (A,B) here does not help much when you have a range search on the earlier column A. Maybe only help to reduce the data access that is not required when the B condition fail.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: inner join on range criteria: unable to use index?
3113
August 12, 2008 07:11PM


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.