Doc: Clarify the role of aggressive VACUUMs.

Adjust the documentation's coverage of aggressive VACUUMs to make it
clearer that aggressive vacuuming isn't always strictly necessary.  It's
possible for non-aggressive VACUUMs to advance relfrozenxid/relminmxid
without fail, given the right workload conditions.

While this has always been true, it matters more with recent and pending
improvements to VACUUM.  These improvements make non-aggressive
vacuuming more likely to advance relfrozenxid/relminmxid in practice.
While this is an unrelated improvement to the docs, formally speaking,
it still doesn't seem worth backpatching.  So don't backpatch.
This commit is contained in:
Peter Geoghegan 2022-04-02 12:29:35 -07:00
parent 1b208ebaf1
commit f7e4d5c64f
1 changed files with 8 additions and 6 deletions

View File

@ -493,16 +493,17 @@
will skip pages that don't have any dead row versions even if those pages will skip pages that don't have any dead row versions even if those pages
might still have row versions with old XID values. Therefore, normal might still have row versions with old XID values. Therefore, normal
<command>VACUUM</command>s won't always freeze every old row version in the table. <command>VACUUM</command>s won't always freeze every old row version in the table.
Periodically, <command>VACUUM</command> will perform an <firstterm>aggressive When that happens, <command>VACUUM</command> will eventually need to perform an
vacuum</firstterm>, skipping only those pages which contain neither dead rows nor <firstterm>aggressive vacuum</firstterm>, which will freeze all eligible unfrozen
any unfrozen XID or MXID values. XID and MXID values, including those from all-visible but not all-frozen pages.
In practice most tables require periodic aggressive vacuuming.
<xref linkend="guc-vacuum-freeze-table-age"/> <xref linkend="guc-vacuum-freeze-table-age"/>
controls when <command>VACUUM</command> does that: all-visible but not all-frozen controls when <command>VACUUM</command> does that: all-visible but not all-frozen
pages are scanned if the number of transactions that have passed since the pages are scanned if the number of transactions that have passed since the
last such scan is greater than <varname>vacuum_freeze_table_age</varname> minus last such scan is greater than <varname>vacuum_freeze_table_age</varname> minus
<varname>vacuum_freeze_min_age</varname>. Setting <varname>vacuum_freeze_min_age</varname>. Setting
<varname>vacuum_freeze_table_age</varname> to 0 forces <command>VACUUM</command> to <varname>vacuum_freeze_table_age</varname> to 0 forces <command>VACUUM</command> to
use this more aggressive strategy for all scans. always use its aggressive strategy.
</para> </para>
<para> <para>
@ -711,8 +712,9 @@ HINT: Stop the postmaster and vacuum that database in single-user mode.
</para> </para>
<para> <para>
Aggressive <command>VACUUM</command> scans, regardless of Aggressive <command>VACUUM</command>s, regardless of what causes
what causes them, enable advancing the value for that table. them, are <emphasis>guaranteed</emphasis> to be able to advance
the table's <structfield>relminmxid</structfield>.
Eventually, as all tables in all databases are scanned and their Eventually, as all tables in all databases are scanned and their
oldest multixact values are advanced, on-disk storage for older oldest multixact values are advanced, on-disk storage for older
multixacts can be removed. multixacts can be removed.