A bitmap heap scan is the second phase of bitmap index access. A preceding Bitmap Index Scan collects matching row or page locations into a bitmap; the heap scan then visits those locations and retrieves the requested table data in bulk. section 4.5.2
Read a bitmap heap scan in an execution plan by checking:
- The Bitmap Index Scan, which applies the index condition and builds the bitmap instead of fetching table rows immediately. section 4.5.2
- The Bitmap Heap Scan, which visits the table locations recorded in the bitmap and returns the requested columns. section 4.5.2
- Recheck Cond, which shows that PostgreSQL evaluates the condition again while examining heap rows, especially when the bitmap contains approximate page locations. section 5.6.2 section 9.7.2
- Heap Blocks and Rows Removed by Index Recheck, which indicate exact or lossy bitmap behavior and the amount of extra filtering performed. section 5.6.2 section 9.7.2
Finding several champions
For a query using IN, PostgreSQL can build one bitmap from the hash index and then read the matching player rows together:\n\nSELECT username, champion_title, score, level\nFROM game.player_stats\nWHERE champion_title IN ('Airforce Warlord', 'Naval Warlord', 'Land Warlord', 'Cyber Warlord', 'Space Warlord');\n\nThe plan reports Bitmap Heap Scan on player_stats with rows=5 and Heap Blocks: exact=4, followed by Bitmap Index Scan on idx_champion_title. The heap phase also reports Recheck Cond, making the two-stage execution visible.
