Hi,
I've tried the folowing query:
SELECT DISTINCT column1 FROM table1 LIMIT 10;
and got the result for 0.23 sec.
Then I've tried the same query without limit:
SELECT DISTINCT column1 FROM table1;
and got the result for 0.01 sec. which is some 23 times
faster. There are about 10000 rows in table1 and column1
has an index. I've read in the manual that MySQL uses optimization when you
combine DISTINCT with LIMIT n that would make it stop as soon as it finds n
unique rows.
Why then the first query that uses LIMIT is considerably slower?
George
----
Безплатна пощенска служба http://mail.Rambler.bg/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php