1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!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>66.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="66.3. Free Space Map" /><link rel="next" href="storage-init.html" title="66.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">66.4. Visibility Map</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="storage-fsm.html" title="66.3. Free Space Map">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="storage.html" title="Chapter 66. Database Physical Storage">Up</a></td><th width="60%" align="center">Chapter 66. Database Physical Storage</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="storage-init.html" title="66.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">66.4. Visibility Map <a href="#STORAGE-VM" class="id_link">#</a></h2></div></div></div><a id="id-1.10.18.6.2" class="indexterm"></a><a id="id-1.10.18.6.3" class="indexterm"></a><p>
3 Each heap relation has a Visibility Map
4 (VM) to keep track of which pages contain only tuples that are known to be
5 visible to all active transactions; it also keeps track of which pages contain
6 only frozen tuples. It's stored
7 alongside the main relation data in a separate relation fork, named after the
8 filenode number of the relation, plus a <code class="literal">_vm</code> suffix. For example,
9 if the filenode of a relation is 12345, the VM is stored in a file called
10 <code class="filename">12345_vm</code>, in the same directory as the main relation file.
11 Note that indexes do not have VMs.
13 The visibility map stores two bits per heap page. The first bit, if set,
14 indicates that the page is all-visible, or in other words that the page does
15 not contain any tuples that need to be vacuumed.
16 This information can also be used
17 by <a class="link" href="indexes-index-only-scans.html" title="11.9. Index-Only Scans and Covering Indexes"><em class="firstterm">index-only
18 scans</em></a> to answer queries using only the index tuple.
19 The second bit, if set, means that all tuples on the page have been frozen.
20 That means that even an anti-wraparound vacuum need not revisit the page.
22 The map is conservative in the sense that we make sure that whenever a bit is
23 set, we know the condition is true, but if a bit is not set, it might or
24 might not be true. Visibility map bits are only set by vacuum, but are
25 cleared by any data-modifying operations on a page.
27 The <a class="xref" href="pgvisibility.html" title="F.36. pg_visibility — visibility map information and utilities">pg_visibility</a> module can be used to examine the
28 information stored in the visibility map.
29 </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="66.3. Free Space Map">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="storage.html" title="Chapter 66. Database Physical Storage">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="storage-init.html" title="66.5. The Initialization Fork">Next</a></td></tr><tr><td width="40%" align="left" valign="top">66.3. Free Space Map </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 66.5. The Initialization Fork</td></tr></table></div></body></html>