Plan nodes · Scans
Sample Scan
Reads a random sample of a table (TABLESAMPLE).
Implements TABLESAMPLE: SYSTEM picks whole pages at random, BERNOULLI picks rows from every page. Faster than ORDER BY random() because it does not read the whole table (SYSTEM) or sort it.
Example
SELECT * FROM tracks TABLESAMPLE SYSTEM (1)
1 node
Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →
Related
Seq Scan · Index Scan · Index Only Scan · Bitmap Index Scan · Bitmap Heap Scan · BitmapAnd · BitmapOr · Tid Scan · Tid Range Scan · Subquery Scan · Function Scan · Table Function Scan · Values Scan · CTE Scan · WorkTable Scan · Named Tuplestore Scan · Foreign Scan · Custom Scan