I\'d like to optimize my queries so I look into mysql-slow.log.
Most of my slow queries contains ORDER BY RAND(). I cannot find a real solu
(Yeah, I will get dinged for not having enough meat here, but can't you be a vegan for one day?)
Case: Consecutive AUTO_INCREMENT without gaps, 1 row returned
Case: Consecutive AUTO_INCREMENT without gaps, 10 rows
Case: AUTO_INCREMENT with gaps, 1 row returned
Case: Extra FLOAT column for randomizing
Case: UUID or MD5 column
Those 5 cases can be made very efficient for large tables. See my blog for the details.