1
by Martin Pitt
Import upstream version 9.3~beta1 |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2 |
<HTML |
|
3 |
><HEAD |
|
4 |
><TITLE |
|
5 |
>Visibility Map</TITLE |
|
6 |
><META |
|
7 |
NAME="GENERATOR" |
|
8 |
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK |
|
9 |
REV="MADE" |
|
10 |
HREF="mailto:pgsql-docs@postgresql.org"><LINK |
|
11 |
REL="HOME" |
|
1.1.11
by Martin Pitt
Import upstream version 9.3.12 |
12 |
TITLE="PostgreSQL 9.3.12 Documentation" |
1
by Martin Pitt
Import upstream version 9.3~beta1 |
13 |
HREF="index.html"><LINK |
14 |
REL="UP" |
|
15 |
TITLE="Database Physical Storage" |
|
16 |
HREF="storage.html"><LINK |
|
17 |
REL="PREVIOUS" |
|
18 |
TITLE="Free Space Map" |
|
19 |
HREF="storage-fsm.html"><LINK |
|
20 |
REL="NEXT" |
|
21 |
TITLE="The Initialization Fork" |
|
22 |
HREF="storage-init.html"><LINK |
|
23 |
REL="STYLESHEET" |
|
24 |
TYPE="text/css" |
|
25 |
HREF="stylesheet.css"><META |
|
26 |
HTTP-EQUIV="Content-Type" |
|
27 |
CONTENT="text/html; charset=ISO-8859-1"><META |
|
28 |
NAME="creation" |
|
1.1.11
by Martin Pitt
Import upstream version 9.3.12 |
29 |
CONTENT="2016-03-28T20:28:06"></HEAD |
1
by Martin Pitt
Import upstream version 9.3~beta1 |
30 |
><BODY |
31 |
CLASS="SECT1" |
|
32 |
><DIV |
|
33 |
CLASS="NAVHEADER" |
|
34 |
><TABLE |
|
35 |
SUMMARY="Header navigation table" |
|
36 |
WIDTH="100%" |
|
37 |
BORDER="0" |
|
38 |
CELLPADDING="0" |
|
39 |
CELLSPACING="0" |
|
40 |
><TR |
|
41 |
><TH |
|
42 |
COLSPAN="5" |
|
43 |
ALIGN="center" |
|
44 |
VALIGN="bottom" |
|
45 |
><A |
|
46 |
HREF="index.html" |
|
1.1.11
by Martin Pitt
Import upstream version 9.3.12 |
47 |
>PostgreSQL 9.3.12 Documentation</A |
1
by Martin Pitt
Import upstream version 9.3~beta1 |
48 |
></TH |
49 |
></TR |
|
50 |
><TR |
|
51 |
><TD |
|
52 |
WIDTH="10%" |
|
53 |
ALIGN="left" |
|
54 |
VALIGN="top" |
|
55 |
><A |
|
56 |
TITLE="Free Space Map" |
|
57 |
HREF="storage-fsm.html" |
|
58 |
ACCESSKEY="P" |
|
59 |
>Prev</A |
|
60 |
></TD |
|
61 |
><TD |
|
62 |
WIDTH="10%" |
|
63 |
ALIGN="left" |
|
64 |
VALIGN="top" |
|
65 |
><A |
|
66 |
HREF="storage.html" |
|
67 |
ACCESSKEY="U" |
|
68 |
>Up</A |
|
69 |
></TD |
|
70 |
><TD |
|
71 |
WIDTH="60%" |
|
72 |
ALIGN="center" |
|
73 |
VALIGN="bottom" |
|
74 |
>Chapter 58. Database Physical Storage</TD |
|
75 |
><TD |
|
76 |
WIDTH="20%" |
|
77 |
ALIGN="right" |
|
78 |
VALIGN="top" |
|
79 |
><A |
|
80 |
TITLE="The Initialization Fork" |
|
81 |
HREF="storage-init.html" |
|
82 |
ACCESSKEY="N" |
|
83 |
>Next</A |
|
84 |
></TD |
|
85 |
></TR |
|
86 |
></TABLE |
|
87 |
><HR |
|
88 |
ALIGN="LEFT" |
|
89 |
WIDTH="100%"></DIV |
|
90 |
><DIV |
|
91 |
CLASS="SECT1" |
|
92 |
><H1 |
|
93 |
CLASS="SECT1" |
|
94 |
><A |
|
95 |
NAME="STORAGE-VM" |
|
96 |
>58.4. Visibility Map</A |
|
97 |
></H1 |
|
98 |
><P |
|
99 |
>Each heap relation has a Visibility Map
|
|
100 |
(VM) to keep track of which pages contain only tuples that are known to be |
|
101 |
visible to all active transactions. It's stored |
|
102 |
alongside the main relation data in a separate relation fork, named after the |
|
103 |
filenode number of the relation, plus a <TT |
|
104 |
CLASS="LITERAL" |
|
105 |
>_vm</TT |
|
106 |
> suffix. For example,
|
|
107 |
if the filenode of a relation is 12345, the VM is stored in a file called |
|
108 |
<TT |
|
109 |
CLASS="FILENAME" |
|
110 |
>12345_vm</TT |
|
111 |
>, in the same directory as the main relation file.
|
|
112 |
Note that indexes do not have VMs.</P |
|
113 |
><P |
|
114 |
>The visibility map simply stores one bit per heap page. A set bit means
|
|
115 |
that all tuples on the page are known to be visible to all transactions. |
|
116 |
This means that the page does not contain any tuples that need to be vacuumed. |
|
117 |
This information can also be used by <I |
|
118 |
CLASS="FIRSTTERM" |
|
119 |
>index-only scans</I |
|
120 |
> to answer
|
|
121 |
queries using only the index tuple.</P |
|
122 |
><P |
|
123 |
>The map is conservative in the sense that we make sure that whenever a bit is
|
|
124 |
set, we know the condition is true, but if a bit is not set, it might or |
|
125 |
might not be true. Visibility map bits are only set by vacuum, but are |
|
126 |
cleared by any data-modifying operations on a page.</P |
|
127 |
></DIV |
|
128 |
><DIV |
|
129 |
CLASS="NAVFOOTER" |
|
130 |
><HR |
|
131 |
ALIGN="LEFT" |
|
132 |
WIDTH="100%"><TABLE |
|
133 |
SUMMARY="Footer navigation table" |
|
134 |
WIDTH="100%" |
|
135 |
BORDER="0" |
|
136 |
CELLPADDING="0" |
|
137 |
CELLSPACING="0" |
|
138 |
><TR |
|
139 |
><TD |
|
140 |
WIDTH="33%" |
|
141 |
ALIGN="left" |
|
142 |
VALIGN="top" |
|
143 |
><A |
|
144 |
HREF="storage-fsm.html" |
|
145 |
ACCESSKEY="P" |
|
146 |
>Prev</A |
|
147 |
></TD |
|
148 |
><TD |
|
149 |
WIDTH="34%" |
|
150 |
ALIGN="center" |
|
151 |
VALIGN="top" |
|
152 |
><A |
|
153 |
HREF="index.html" |
|
154 |
ACCESSKEY="H" |
|
155 |
>Home</A |
|
156 |
></TD |
|
157 |
><TD |
|
158 |
WIDTH="33%" |
|
159 |
ALIGN="right" |
|
160 |
VALIGN="top" |
|
161 |
><A |
|
162 |
HREF="storage-init.html" |
|
163 |
ACCESSKEY="N" |
|
164 |
>Next</A |
|
165 |
></TD |
|
166 |
></TR |
|
167 |
><TR |
|
168 |
><TD |
|
169 |
WIDTH="33%" |
|
170 |
ALIGN="left" |
|
171 |
VALIGN="top" |
|
172 |
>Free Space Map</TD |
|
173 |
><TD |
|
174 |
WIDTH="34%" |
|
175 |
ALIGN="center" |
|
176 |
VALIGN="top" |
|
177 |
><A |
|
178 |
HREF="storage.html" |
|
179 |
ACCESSKEY="U" |
|
180 |
>Up</A |
|
181 |
></TD |
|
182 |
><TD |
|
183 |
WIDTH="33%" |
|
184 |
ALIGN="right" |
|
185 |
VALIGN="top" |
|
186 |
>The Initialization Fork</TD |
|
187 |
></TR |
|
188 |
></TABLE |
|
189 |
></DIV |
|
190 |
></BODY |
|
191 |
></HTML |
|
192 |
>
|