A.J. Millan,

At 01:31 PM 1/31/2004, you wrote:

In respect to ORDER BY ... DESC combined with LIMIT 1:

I´v arrived to this other for my own (thank you anyway), but I suspect that
maybe it is not very efficient from the computation point of view (I suppose
it must travel the whole table to discard the undesired results).

You would be correct if the column you are sorting on is not indexed. If the column is indexed, then MySQL traverses just one row. On an 8 million row table it takes just 0.03 seconds to return the row with the largest value.


Mike



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



Reply via email to