What is a fast way to select a random row from a large mysql table?
I\'m working in php, but I\'m interested in any solution even if it\'s in another language.
For selecting multiple random rows from a given table (say 'words'), our team came up with this beauty:
SELECT * FROM `words` AS r1 JOIN (SELECT MAX(`WordID`) as wid_c FROM `words`) as tmp1 WHERE r1.WordID >= (SELECT (RAND() * tmp1.wid_c) AS id) LIMIT n