Bitmap scans are a multi-step process that consist of a Bitmap Heap Scan, one or more Bitmap Index Scans and optionally BitmapOr and BitmapAnd operations.

The Bitmap Heap Scan reads pages from a bitmap created by the other operations, filtering out any rows that don't match the condition.

This has the advantage that the pages can be read in order, like in a sequential scan, avoiding random I/O and hopefully thus making the reads faster.

It also means that, like in an index scan, only some pages need to be read rather than all of them.

If the bitmap does not fit in memory, defined by work_mem, Postgres will make some blocks lossy.

 


For more help deciphering query plans, check out our product pgMustard.


Last checked: September 2024, PostgreSQL 17

Issue reports and suggestions are welcome, please get in touch.