MySQL Forums
Forum List  »  Optimizer & Parser

Re: Select last row that is less than or equal to a date
Posted by: Rick James
Date: February 03, 2013 10:43AM

Øystein, I have long suspected that the optimizer is less than optimal in the compound-index + DESC case:
INDEX(a,b)
WHERE a=1 ORDER BY b DESC
The equivalent ASC code seems to be optimized, but the DESC case seems to fail to "jump to the end of a=1, then read backwards".

I don't know whether the "AND b < 123" factors into the issue.

Whenever I suspect this, I realize that there aren't enough rows to worry about, and I move on to other issues. (I first suspected this in the 4.0 days.)

Good luck.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Select last row that is less than or equal to a date
1710
February 03, 2013 10:43AM


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.