MySQL Forums
Forum List  »  Performance

Re: how could this be?
Posted by: Nathan Cheng
Date: November 21, 2004 02:33AM

EXPLAIN shows that mysql is selecting the least optimal table order when the LIMIT clause is used, by correctly uses the optimal table order when LIMIT is not used. How can I force the table order?

For the time being, I have fixed the problem by using a GROUP BY on the primary_key_id instead of a SELECT DISTINCT. I am lucky in that mysql is using the optimal table order in this case even with the LIMIT clause.

It does seem there is a bug here, though, since logically a query with both the ORDER BY and LIMIT clauses and the same query with only the ORDER BY clause and no LIMIT clause will _always_ have the same optimal execution path. Does anybody not agree?

Nathan

Options: ReplyQuote


Subject
Views
Written By
Posted
3069
November 20, 2004 01:58PM
Re: how could this be?
2210
November 21, 2004 02:33AM
2125
November 21, 2004 04:04PM
2200
November 21, 2004 04:16PM


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.