Put a index on col3 and it will be faster. That's the only way as far as I
know.
--
Chris.
----- Original Message -----
From: "Michael Monashev" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Wednesday, July 20, 2005 3:04 PM
Subject: random rows selection
Hello,
How to select 5 random rows from big table with WHERE clause?
This query very slow on 1 mln rows:
SELECT col1, col2 FROM table WHERE col3=123 ORDER BY RAND() LIMIT 5
Have you a faster one?
Sincerely,
Michael,
http://xoib.com/ http://3d2f.com/
http://qaix.com/ http://ryxi.com/
http://gyxe.com/ http://gyxu.com/
http://xywe.com/ http://xyqe.com/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]