my table is small but I can't tell what is faster.. a max or a limit
mysql> select max(counter) from web; mysql> select counter from web order by counter desc;
They seem to be the same in performance.
Regards, Jake Johnson [EMAIL PROTECTED]
Jake,
I tried them both on a million row table and they are the same speed (you should use the "LIMIT 1" if using the "order by counter desc" because you only need 1 row returned.) Same speed also for InnoDb tables.
Mike
______________________________________________________________________ Plutoid - http://www.plutoid.com - Shop Plutoid for the best prices on Rims, Car Audio, and Performance Parts.
On Sun, 20 Jul 2003, mos wrote:
> At 12:32 PM 7/20/2003, you wrote: > >This is probably easy, but I just can't to put my finger on it. I have a > >list of numbers (i.e. 1 to 175) and I want to do a select statement to > >get the highest number. I have tried the limit thing but not getting the > >right output. Can someone shed some light on this? > > > >TIA > > select * from table order by numcol desc limit 1 > > Mike > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]