Rick T. answered 08/11/21
Neuroscience, Psychology, Research Methods and Data Science Tutor
The fastest way to select random rows from a MySQL database is to use the RAND function. The number of rows returned can be set using LIMIT. For example:
SELECT *
FROM table
ORDER BY RAND ()
LIMIT 10;
Exactly how fast is fast depends on how the tables are indexed. You can view the execution time and the index used by preceding the query with EXPLAIN ANALYZE.