Because you are sorting the results, the LIMIT clause has to be applied after all of the eligible rows have been retrieved. There shouldn't be a big difference between 2 and 3, but there would be between 2 and 20000.
Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com >-----Original Message----- >From: Kristian Davies [mailto:kristian.dav...@gmail.com] >Sent: Wednesday, August 04, 2010 5:03 AM >To: mysql@lists.mysql.com >Subject: ORDER BY LIMIT issue > >With the following query if I it returns 2 results it's fast .04s, if >it has less results than the limit it takes 1minute. > >Query: > select * from hub_dailies_sp where active='1' and date='2010-08-04' >order by id desc LIMIT 2; > >Show create table: >http://pastebin.org/447171 > >27,000 rows in table/view > >Can anyone shed any light? > >Cheers, >Kristian > >-- >MySQL General Mailing List >For list archives: http://lists.mysql.com/mysql >To unsubscribe: http://lists.mysql.com/mysql?unsub=je...@gii.co.jp -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org