Radim Marek: How TABLESAMPLE picks rows
Most exploratory questions against a large table only need a rough answer, but without an index on status, even "roughly how many shipped orders" costs a full scan. On the two-million-row orders table, Postgres has to read every single 8 kB page, all 18,085 of them (141 MB), just to count matching…
Sources
- T2Radim Marek: How TABLESAMPLE picks rowsPlanet PostgreSQL