Table of Contents

Interpreting PostgreSQL Analyze

When the output contains lossy heap blocks

Heap Blocks: exact=59675 lossy=54095

the work_mem needs to be increased

SET work_mem="64MB";

And then recheck if there are still lossy blocks

References

https://pganalyze.com/docs/explain/insights/lossy-bitmaps

What are those 'Bitmap Heap Scan' rows?

Found a lot of explanations but my favorite is from
https://www.cybertec-postgresql.com/en/postgresql-indexing-index-scan-vs-bitmap-scan-vs-sequential-scan-basics/

Bitmap Heap Scan on sampletable (cost=9313.62..68396.35 rows=402218 width=11)
       Recheck Cond: (x < '423'::numeric)
       -> Bitmap Index Scan on idx_x (cost=0.00..9213.07 rows=402218 width=0)
          Index Cond: (x < '423'::numeric)

“PostgreSQL will first scan the index and compile those rows / blocks, which are needed at the end of the scan. Then PostgreSQL will take this list and go to the table to really fetch those rows. The beauty is that this mechanism even works if you are using more than just one index.”

Keywords: psql analyze explain postgresql sql