Category Archives: SQL

Fetch random rows faster with recycled IDs

Say you need to quickly fetch a random row from a database table. What’s your approach? If you answered: SELECT * FROM tablename ORDER BY rand() LIMIT 1 …you’re probably in the majority, and in many cases right. However, the … Continue reading

Posted in Ideas, Optimization, SQL | Leave a comment