mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Doc updates for index-only scans.
Document that routine vacuuming is now also important for the purpose of index-only scans; and mention in the section that describes the visibility map that it is used to implement index-only scans. Marti Raudsepp, with some changes by me.
This commit is contained in:
@@ -101,6 +101,11 @@
|
||||
<productname>PostgreSQL</productname> query planner.</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>To update the visibility map, which speeds up index-only
|
||||
scans.</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>To protect against loss of very old data due to
|
||||
<firstterm>transaction ID wraparound</>.</simpara>
|
||||
@@ -329,6 +334,33 @@
|
||||
</tip>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="vacuum-for-visibility-map">
|
||||
<title>Updating The Visibility Map</title>
|
||||
|
||||
<para>
|
||||
Vacuum maintains a <link linkend="storage-vm">visibility map</> for each
|
||||
table to keep track of which pages contain only tuples that are known to be
|
||||
visible to all active transactions (and all future transactions, until the
|
||||
page is again modified). This has two purposes. First, vacuum
|
||||
itself can skip such pages on the next run, since there is nothing to
|
||||
clean up.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Second, it allows <productname>PostgreSQL</productname> to answer some
|
||||
queries using only the index, without reference to the underlying table.
|
||||
Since <productname>PostgreSQL</productname> indexes don't contain tuple
|
||||
visibility information, a normal index scan fetches the heap tuple for each
|
||||
matching index entry, to check whether it should be seen by the current
|
||||
transaction. An <firstterm>index-only scan</>, on the other hand, checks
|
||||
the visibility map first. If it's known that all tuples on the page are
|
||||
visible, the heap fetch can be skipped. This is most noticeable on
|
||||
large data sets where the visibility map can prevent disk accesses.
|
||||
The visibility map is vastly smaller than the heap, so it can easily be
|
||||
cached even when the heap is very large.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="vacuum-for-wraparound">
|
||||
<title>Preventing Transaction ID Wraparound Failures</title>
|
||||
|
||||
|
Reference in New Issue
Block a user