summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/storage-vm.html
blob: d0b9d3dacaf0e31d24552f36ba07ebf008c6655a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>73.4. Visibility Map</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="storage-fsm.html" title="73.3. Free Space Map" /><link rel="next" href="storage-init.html" title="73.5. The Initialization Fork" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">73.4. Visibility Map</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="storage-fsm.html" title="73.3. Free Space Map">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="storage.html" title="Chapter 73. Database Physical Storage">Up</a></td><th width="60%" align="center">Chapter 73. Database Physical Storage</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="storage-init.html" title="73.5. The Initialization Fork">Next</a></td></tr></table><hr /></div><div class="sect1" id="STORAGE-VM"><div class="titlepage"><div><div><h2 class="title" style="clear: both">73.4. Visibility Map</h2></div></div></div><a id="id-1.10.24.6.2" class="indexterm"></a><a id="id-1.10.24.6.3" class="indexterm"></a><p>
Each heap relation has a Visibility Map
(VM) to keep track of which pages contain only tuples that are known to be
visible to all active transactions; it also keeps track of which pages contain
only frozen tuples.  It's stored
alongside the main relation data in a separate relation fork, named after the
filenode number of the relation, plus a <code class="literal">_vm</code> suffix. For example,
if the filenode of a relation is 12345, the VM is stored in a file called
<code class="filename">12345_vm</code>, in the same directory as the main relation file.
Note that indexes do not have VMs.
</p><p>
The visibility map stores two bits per heap page.  The first bit, if set,
indicates that the page is all-visible, or in other words that the page does
not contain any tuples that need to be vacuumed.
This information can also be used
by <a class="link" href="indexes-index-only-scans.html" title="11.9. Index-Only Scans and Covering Indexes"><em class="firstterm">index-only
scans</em></a> to answer queries using only the index tuple.
The second bit, if set, means that all tuples on the page have been frozen.
That means that even an anti-wraparound vacuum need not revisit the page.
</p><p>
The map is conservative in the sense that we make sure that whenever a bit is
set, we know the condition is true, but if a bit is not set, it might or
might not be true. Visibility map bits are only set by vacuum, but are
cleared by any data-modifying operations on a page.
</p><p>
The <a class="xref" href="pgvisibility.html" title="F.36. pg_visibility">pg_visibility</a> module can be used to examine the
information stored in the visibility map.
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="storage-fsm.html" title="73.3. Free Space Map">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="storage.html" title="Chapter 73. Database Physical Storage">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="storage-init.html" title="73.5. The Initialization Fork">Next</a></td></tr><tr><td width="40%" align="left" valign="top">73.3. Free Space Map </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 73.5. The Initialization Fork</td></tr></table></div></body></html>