Fetch random results form MySQL
If you read the MySQL manual you might have seen the ORDER BY RAND() to randomize the the rows and using the LIMIT 1 to just take one of the rows. The reason that ordering by RAND() can be slow is that you’re forcing the database to actually sort the whole table before returning anything. […]