J
jeremy
Text
Efficient PostgreSQL Strategies for Selecting Random Rows from Large Tables
This article explains why ORDER BY random() is so slow on a big table: the database has to make a fresh random number for every single row and sort them all just to hand back a few. It then shows che…