At 09:22 AM 4/15/05, DebugasRu wrote:

taken from the manual 3.6.2 The Row Holding the Maximum of a Certain Column
which of the two queries will in general be faster:

1)
SELECT article, dealer, price
FROM   shop
WHERE  price=(SELECT MAX(price) FROM shop);

2)
SELECT article, dealer, price
FROM   shop
ORDER BY price DESC
LIMIT 1;

or does it all depend on a given situation ?


As mentioned in the manual, the two queries are not always going to return identical results. That should be a clue that results depend on given situation, but my guess is that second one will faster more often than the first. The first query is expected to get slower as number of rows returned increases.


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to