User Tools

Site Tools


pgsql_analyze

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

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

pgsql_analyze.txt · Last modified: 2024/04/11 14:23 by 127.0.0.1