Databases
Bug Report
ORDER BY RAND() LIMIT 1 on a hot endpoint melted our MySQL primary
A 'random tip of the day' widget used ORDER BY RAND() LIMIT 1. It was fine at 5,000 rows and pinned the primary at 100 percent CPU at 1.4 million. Here is how we proved it and three random-row strategies that use an index instead.