|
9 | 9 |
|
10 | 10 | <para>
|
11 | 11 | The <filename>pg_visibility</> module provides a means for examining the
|
12 |
| - visibility map (VM) and page-level visibility information. It also |
13 |
| - provides functions to check the integrity of the visibility map and to |
| 12 | + visibility map (VM) and page-level visibility information of a table. |
| 13 | + It also provides functions to check the integrity of a visibility map and to |
14 | 14 | force it to be rebuilt.
|
15 | 15 | </para>
|
16 | 16 |
|
17 | 17 | <para>
|
18 | 18 | Three different bits are used to store information about page-level
|
19 | 19 | visibility. The all-visible bit in the visibility map indicates that every
|
20 |
| - tuple on a given page of a relation is visible to every current transaction. |
21 |
| - The all-frozen bit in the visibility map indicates that every tuple on the |
22 |
| - page is frozen; that is, no future vacuum will need to modify the page |
23 |
| - until such time as a tuple is inserted, updated, deleted, or locked on |
24 |
| - that page. The page-level <literal>PD_ALL_VISIBLE</literal> bit has the |
| 20 | + tuple in the corresponding page of the relation is visible to every current |
| 21 | + and future transaction. The all-frozen bit in the visibility map indicates |
| 22 | + that every tuple in the page is frozen; that is, no future vacuum will need |
| 23 | + to modify the page until such time as a tuple is inserted, updated, deleted, |
| 24 | + or locked on that page. |
| 25 | + The page header's <literal>PD_ALL_VISIBLE</literal> bit has the |
25 | 26 | same meaning as the all-visible bit in the visibility map, but is stored
|
26 |
| - within the data page itself rather than a separate data structure. These |
27 |
| - will normally agree, but the page-level bit can sometimes be set while the |
28 |
| - visibility map bit is clear after a crash recovery; or they can disagree |
29 |
| - because of a change which occurs after <literal>pg_visibility</> examines |
30 |
| - the visibility map and before it examines the data page. Any event which |
31 |
| - causes data corruption can also cause these bits to disagree. |
| 27 | + within the data page itself rather than in a separate data structure. |
| 28 | + These two bits will normally agree, but the page's all-visible bit can |
| 29 | + sometimes be set while the visibility map bit is clear after a crash |
| 30 | + recovery. The reported values can also disagree because of a change that |
| 31 | + occurs after <literal>pg_visibility</> examines the visibility map and |
| 32 | + before it examines the data page. Any event that causes data corruption |
| 33 | + can also cause these bits to disagree. |
32 | 34 | </para>
|
33 | 35 |
|
34 | 36 | <para>
|
35 |
| - Functions which display information about <literal>PD_ALL_VISIBLE</> |
36 |
| - are much more costly than those which only consult the visibility map, |
| 37 | + Functions that display information about <literal>PD_ALL_VISIBLE</> bits |
| 38 | + are much more costly than those that only consult the visibility map, |
37 | 39 | because they must read the relation's data blocks rather than only the
|
38 | 40 | (much smaller) visibility map. Functions that check the relation's
|
39 | 41 | data blocks are similarly expensive.
|
|
44 | 46 |
|
45 | 47 | <variablelist>
|
46 | 48 | <varlistentry>
|
47 |
| - <term><function>pg_visibility_map(regclass, blkno bigint, all_visible OUT boolean, all_frozen OUT boolean) returns record</function></term> |
| 49 | + <term><function>pg_visibility_map(relation regclass, blkno bigint, all_visible OUT boolean, all_frozen OUT boolean) returns record</function></term> |
48 | 50 | <listitem>
|
49 | 51 | <para>
|
50 | 52 | Returns the all-visible and all-frozen bits in the visibility map for
|
|
54 | 56 | </varlistentry>
|
55 | 57 |
|
56 | 58 | <varlistentry>
|
57 |
| - <term><function>pg_visibility(regclass, blkno bigint, all_visible OUT boolean, all_frozen OUT boolean, pd_all_visible OUT boolean) returns record</function></term> |
| 59 | + <term><function>pg_visibility(relation regclass, blkno bigint, all_visible OUT boolean, all_frozen OUT boolean, pd_all_visible OUT boolean) returns record</function></term> |
58 | 60 | <listitem>
|
59 | 61 | <para>
|
60 | 62 | Returns the all-visible and all-frozen bits in the visibility map for
|
61 | 63 | the given block of the given relation, plus the
|
62 |
| - <literal>PD_ALL_VISIBLE</> bit for that block. |
| 64 | + <literal>PD_ALL_VISIBLE</> bit of that block. |
63 | 65 | </para>
|
64 | 66 | </listitem>
|
65 | 67 | </varlistentry>
|
66 | 68 |
|
67 | 69 | <varlistentry>
|
68 |
| - <term><function>pg_visibility_map(regclass, blkno OUT bigint, all_visible OUT boolean, all_frozen OUT boolean) returns setof record</function></term> |
| 70 | + <term><function>pg_visibility_map(relation regclass, blkno OUT bigint, all_visible OUT boolean, all_frozen OUT boolean) returns setof record</function></term> |
69 | 71 | <listitem>
|
70 | 72 | <para>
|
71 | 73 | Returns the all-visible and all-frozen bits in the visibility map for
|
72 |
| - each block the given relation. |
| 74 | + each block of the given relation. |
73 | 75 | </para>
|
74 | 76 | </listitem>
|
75 | 77 | </varlistentry>
|
76 | 78 |
|
77 | 79 | <varlistentry>
|
78 |
| - <term><function>pg_visibility(regclass, blkno OUT bigint, all_visible OUT boolean, all_frozen OUT boolean, pd_all_visible OUT boolean) returns setof record</function></term> |
| 80 | + <term><function>pg_visibility(relation regclass, blkno OUT bigint, all_visible OUT boolean, all_frozen OUT boolean, pd_all_visible OUT boolean) returns setof record</function></term> |
79 | 81 |
|
80 | 82 | <listitem>
|
81 | 83 | <para>
|
82 | 84 | Returns the all-visible and all-frozen bits in the visibility map for
|
83 |
| - each block the given relation, plus the <literal>PD_ALL_VISIBLE</> |
84 |
| - bit for each block. |
| 85 | + each block of the given relation, plus the <literal>PD_ALL_VISIBLE</> |
| 86 | + bit of each block. |
85 | 87 | </para>
|
86 | 88 | </listitem>
|
87 | 89 | </varlistentry>
|
88 | 90 |
|
89 | 91 | <varlistentry>
|
90 |
| - <term><function>pg_visibility_map_summary(regclass, all_visible OUT bigint, all_frozen OUT bigint) returns record</function></term> |
| 92 | + <term><function>pg_visibility_map_summary(relation regclass, all_visible OUT bigint, all_frozen OUT bigint) returns record</function></term> |
91 | 93 |
|
92 | 94 | <listitem>
|
93 | 95 | <para>
|
|
96 | 98 | </para>
|
97 | 99 | </listitem>
|
98 | 100 | </varlistentry>
|
99 |
| - |
| 101 | + |
100 | 102 | <varlistentry>
|
101 |
| - <term><function>pg_check_frozen(regclass, t_ctid OUT tid) returns setof tid</function></term> |
| 103 | + <term><function>pg_check_frozen(relation regclass, t_ctid OUT tid) returns setof tid</function></term> |
102 | 104 |
|
103 | 105 | <listitem>
|
104 | 106 | <para>
|
105 |
| - Returns the TIDs of non-frozen tuples present in pages marked all-frozen |
| 107 | + Returns the TIDs of non-frozen tuples stored in pages marked all-frozen |
106 | 108 | in the visibility map. If this function returns a non-empty set of
|
107 |
| - TIDs, the database is corrupt. |
| 109 | + TIDs, the visibility map is corrupt. |
108 | 110 | </para>
|
109 | 111 | </listitem>
|
110 | 112 | </varlistentry>
|
111 |
| - |
112 |
| - <varlistentry> |
113 |
| - <term><function>pg_check_visible(regclass, t_ctid OUT tid) returns setof tid</function></term> |
| 113 | + |
| 114 | + <varlistentry> |
| 115 | + <term><function>pg_check_visible(relation regclass, t_ctid OUT tid) returns setof tid</function></term> |
114 | 116 |
|
115 | 117 | <listitem>
|
116 | 118 | <para>
|
117 |
| - Returns the TIDs of tuples which are not all-visible despite the fact |
118 |
| - that the pages which contain them are marked as all-visible in the |
119 |
| - visibility map. If this function returns a non-empty set of TIDs, the |
120 |
| - database is corrupt. |
| 119 | + Returns the TIDs of non-all-visible tuples stored in pages marked |
| 120 | + all-visible in the visibility map. If this function returns a non-empty |
| 121 | + set of TIDs, the visibility map is corrupt. |
121 | 122 | </para>
|
122 | 123 | </listitem>
|
123 | 124 | </varlistentry>
|
124 | 125 |
|
125 | 126 | <varlistentry>
|
126 |
| - <term><function>pg_truncate_visibility_map(regclass) returns void</function></term> |
| 127 | + <term><function>pg_truncate_visibility_map(relation regclass) returns void</function></term> |
127 | 128 |
|
128 | 129 | <listitem>
|
129 | 130 | <para>
|
130 |
| - Truncates the visibility map for the given relation. This function |
131 |
| - is only expected to be useful if you suspect that the visibility map |
132 |
| - for the indicated relation is corrupt and wish to rebuild it. The first |
133 |
| - <command>VACUUM</> executed on the given relation after this function |
134 |
| - is executed will scan every page in the relation and rebuild the |
135 |
| - visibility map. |
| 131 | + Truncates the visibility map for the given relation. This function is |
| 132 | + useful if you believe that the visibility map for the relation is |
| 133 | + corrupt and wish to force rebuilding it. The first <command>VACUUM</> |
| 134 | + executed on the given relation after this function is executed will scan |
| 135 | + every page in the relation and rebuild the visibility map. (Until that |
| 136 | + is done, queries will treat the visibility map as containing all zeroes.) |
136 | 137 | </para>
|
137 | 138 | </listitem>
|
138 | 139 | </varlistentry>
|
139 | 140 | </variablelist>
|
140 | 141 |
|
141 | 142 | <para>
|
142 |
| - By default, these functions are not publicly executable. |
| 143 | + By default, these functions are executable only by superusers. |
143 | 144 | </para>
|
144 | 145 | </sect2>
|
145 | 146 |
|
|
0 commit comments