MySQL Forums
Forum List  »  Optimizer & Parser

Re: min() vs limit optimization
Posted by: Apachez
Date: July 02, 2006 08:26PM

Well first of all your two queries will most likely produce different results over time. Or rather, you have nothing in your second query that forces the sql engine to produce the same result.

In the second case the processing will be halted once one matching row has been found (limit optimization) and you have no idea which this row might be (can be something currently in key_buffer for example). To make sure that you will get the same result each time you need for example in the second case an ORDER BY.

Currently it is pure luck that your two queries produces the same answer as they look like today.

What does EXPLAIN SELECT tells you about your two queries?

Options: ReplyQuote


Subject
Views
Written By
Posted
5514
July 02, 2006 05:34PM
Re: min() vs limit optimization
2214
July 02, 2006 08:26PM
2157
July 03, 2006 05:22PM
2311
July 04, 2006 06:51AM


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.