LIMIT 0,10 retrieves 10 records, but takes forever!

From: Date: Sun, 31 Mar 2002 15:29:12 +0000
Subject: LIMIT 0,10 retrieves 10 records, but takes forever!
Groups: php.db 
Request: Send a blank email to php-db+get-18078@lists.php.net to get a copy of this message
Hi there, I am having a problem understanding how limit works. As I thought limit restricts the amount of results to a given number. True.. the number of results is only that high how high I specify it with limit. But the querry takes as long as without limit. I am trying to avoid to long waiting times if a user is by exident searching for to many records. This is my querry: SELECT c.*, p.province, co.country FROM test.cities c, test.provinces p, test.countries co WHERE c.city like 'd%' AND p.province_no = c.province_id AND p.country_c = c.country_c AND c.country_c = co.country_c ORDER BY country , province limit 0, 10 This takes 30 s on a 2.5 mio entries table How could I really restrict the results to 10. So that mysql just returns after 10 results? Thanx, Andy

« previous php.db (#18078) next »