What are heap blocks?

What are heap blocks?

The number of non-lossy blocks a bitmap heap scan visited. If a row bitmap is too big to fit into working memory ( work_mem ), some parts of it are made “lossy” – i.e. they refer to whole pages rather than specific rows.

What is a bitmap heap scan?

Description: A bitmap heap scan takes a row location bitmap generated by a Bitmap Index Scan (either directly, or through a series of bitmap set operations via BitmapAnd and BitmapOr nodes) and looks up the relevant data.

What is the heap process?

1. 1. a heap is an area of pre-reserved computer main storage ( memory ) that a program process can use to store data in some variable amount that won’t be known until the program is running.

Does each process have its own heap?

2) Yes, each process gets its own heap.

How is a bitmap heap scan different from an index scan?

The difference is that, rather than visiting every disk page, a bitmap index scan ANDs and ORs applicable indexes together, and only visits the disk pages that it needs to. This is different from an index scan, where the index is visited row by row in order — meaning a disk page may get visited multiple times. Re: the question in your comment…

What does heap blocks exact = 1 mean?

“Heap Blocks: exact=1” means that it only visited one block, and that it was not lossy. (So both of yours rows returned were in the same block) This agrees with the Buffers data. The Bitmap Index Scans and BitmapAnd in total hit 7 blocks. The Heap Scan hit one more, bringing it up to 8.

What happens when a heap scan goes lossy?

If it goes lossy, then the Heap Scan must recheck every row in every lossy block which it visits, because it no longer has information about which particular rows in that block met the search criteria. “Heap Blocks: exact=1” means that it only visited one block, and that it was not lossy. (So both of yours rows returned were in the same block)

Can a bitmap be converted to a lossy block?

Bitmaps can either store a bitmap of rows, or if that becomes too large to fit in work_mem it can “go lossy” by storing a bitmap of blocks. It can do this selectively, so some blocks can be converted lossy while others not.