How TABLESAMPLE picks rows
Summary
This article explains PostgreSQL TABLESAMPLE, comparing SYSTEM and BERNOULLI sampling, and how sampling operates on pages rather than individual rows. It provides practical benchmarks, explores repeatable seeds, and discusses how sampling affects counts, aggregates, and joins, with guidance on when to use which method.