Plan nodes · Scans
Bitmap Heap Scan
Reads the table pages a bitmap points to, in physical order.
Takes the bitmap built by its children and visits each listed page once, in file order, so the reads are nearly sequential. If the bitmap grew too big for work_mem it becomes lossy (whole pages instead of rows), and each row on those pages is rechecked against the condition.
What to look for
"Lossy heap blocks" and rows "removed by recheck" mean work_mem was too small for the bitmap.
Example
SELECT * FROM tracks WHERE ms BETWEEN 100000 AND 101000
2 nodes
- Bitmap Heap Scan on tracksrows 209 (estimated 219) cost 6.54..527.84 buffers: 209 hit, 3 readrecheck
((ms >= 100000) AND (ms <= 101000))209 exact heap blocks- Bitmap Index Scan using tracks_msrows 209 (estimated 219) cost 0..6.48 buffers: 0 hit, 3 readindex condition
((ms >= 100000) AND (ms <= 101000))1 index searches
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 · BitmapAnd · BitmapOr · Tid Scan · Tid Range Scan · Sample Scan · Subquery Scan · Function Scan · Table Function Scan · Values Scan · CTE Scan · WorkTable Scan · Named Tuplestore Scan · Foreign Scan · Custom Scan