Does anyone know, what is the exactly process of Rand() function in MySQL.
I see a lot of people are trying to do a random row with some other method.
How much does it improve performance, Compared with "ORDER BY RAND()" methods?
![]()
Does anyone know, what is the exactly process of Rand() function in MySQL.
I see a lot of people are trying to do a random row with some other method.
How much does it improve performance, Compared with "ORDER BY RAND()" methods?
![]()
SELECT * FROM my_table ORDER BY RAND() LIMIT 1;
This query returns a random row from the table my_table, no matter how many rows there are and no matter if the id is a continuous sequence of numbers or not. With this query you are sure you get a random row every single time.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks