LIMIT limits only to output.
So if a SELECT creates 1 million rows and you LIMIT 10, you got the first 10 rows but
the full SELECT is done.
To speedup consider adding some id columnt with unique ints in ascending order.
I've to go. Have a nice evening.
----- Original Message -----
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 31, 2002 6:29 PM
Subject: [PHP-DB] LIMIT 0,10 retrieves 10 records, but takes forever!
> 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
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php