]> begriffs open source - ai-pg/blob - full-docs/txt/storage-vm.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / storage-vm.txt
1
2 66.4. Visibility Map #
3
4    Each heap relation has a Visibility Map (VM) to keep track of which
5    pages contain only tuples that are known to be visible to all active
6    transactions; it also keeps track of which pages contain only frozen
7    tuples. It's stored alongside the main relation data in a separate
8    relation fork, named after the filenode number of the relation, plus a
9    _vm suffix. For example, if the filenode of a relation is 12345, the VM
10    is stored in a file called 12345_vm, in the same directory as the main
11    relation file. Note that indexes do not have VMs.
12
13    The visibility map stores two bits per heap page. The first bit, if
14    set, indicates that the page is all-visible, or in other words that the
15    page does not contain any tuples that need to be vacuumed. This
16    information can also be used by index-only scans to answer queries
17    using only the index tuple. The second bit, if set, means that all
18    tuples on the page have been frozen. That means that even an
19    anti-wraparound vacuum need not revisit the page.
20
21    The map is conservative in the sense that we make sure that whenever a
22    bit is set, we know the condition is true, but if a bit is not set, it
23    might or might not be true. Visibility map bits are only set by vacuum,
24    but are cleared by any data-modifying operations on a page.
25
26    The pg_visibility module can be used to examine the information stored
27    in the visibility map.