PostgreSQL: What is Visibility Map (VM)?

The Visibility Map is one of the important architectural notes of PostgreSQL.

The Visibility Map associates with each Table and Index.

It stores in separate relation alongside with main relation and It starts with the file node number plus a suffix _vm.

The Visibility Map uses to keep track of which pages contain only tuples that are known to be visible to all active transactions.

It stores one bit per page. If it set bit, that means no free space on the page and all tuples can be visible to running transaction.

If you do not know about the MVCC (Multiversion Concurrency Control), please visit below an article.

What is Multi Version Concurrency Control (MVCC)

Why VACUUM requires in MVCC because VACUUM removes dead row versions in tables and marks the space available for future reuse.

With the Visibility Map, VACUUM will be now able to perform partial scans of the table data, skipping pages which marks as fully visible.

Now Database Administrator happy because partial scans require fewer I/O operations for VACUUM.

The Visibility map bits are only set by vacuum but are cleared by any data-modifying operations on a page.

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of