Hi,
Is there a quicker way to get a selection of random rows than RAND()?
I basically use:
SELECT * FROM table ORDER BY RAND() LIMIT 3;
But I find that as the # of rows increases in table, it keeps taking longer
and longer to get a result back. And I am talking a large increase,
basically 50
Hi,
Can someone tell me which query would be faster with say 1000 rows:
SELECT * FROM table ORDER BY RAND() LIMIT 3;
or SELECT * FROM table;
then use php to get 3 random rows from the returned data?
-
Before posting, please
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 2:44 PM
To: Jon Frisby
Cc: mysql
Subject: Re: Rand slowness.
I tried this, but it seems to be ignoring the LIMIT 3, since it
is returning
all the rows.
Try:
SELECT RAND() AS r, * FROM table ORDER BY r LIMIT 3;
Off the top of my