How to take random samples from big PostgreSQL tables
How-to 10 min +100 XP
Random sampling from billion-row PostgreSQL tables with ORDER BY random() scans every row and runs a top-N heapsort, taking over a minute.
Random sampling from billion-row PostgreSQL tables with ORDER BY random() scans every row and runs a top-N heapsort, taking over a minute.
A simple LIMIT 1 join between a ~100k-row postgres_dbs table and a ~90M-row events table ran for hours.