Loading

Sunday, April 17, 2005

Faster way of getting random rows in mysql instead of using order by rand()

1. create a new indexed column (= column_x) that's integer incremented for each table
2. select count(*) to get # of rows
3. use the app to generate X # of integers between 1 and last row
4. select * from table where column_x in (rand1, rand2, rand3, ...)

SHARE TWEET

Thank you for reading this article Faster way of getting random rows in mysql instead of using order by rand() With URL http://x-tutorials.blogspot.com/2005/04/faster-way-of-getting-random-rows-in.html. Also a time to read the other articles.

0 comments:

Write your comment for this article Faster way of getting random rows in mysql instead of using order by rand() above!