diff options
author | Peter Geoghegan <pg@bowt.ie> | 2021-03-10 16:27:01 -0800 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2021-03-10 16:27:01 -0800 |
commit | 9f3665fbfc34b963933e51778c7feaa8134ac885 (patch) | |
tree | f06201f72fc31718beb0b17f48facb270c28df26 /doc/src | |
parent | 845ac7f847a25505e91f30dca4e0330b25785ee0 (diff) | |
download | postgresql-9f3665fbfc34b963933e51778c7feaa8134ac885.tar.gz postgresql-9f3665fbfc34b963933e51778c7feaa8134ac885.zip |
Don't consider newly inserted tuples in nbtree VACUUM.
Remove the entire idea of "stale stats" within nbtree VACUUM (stop
caring about stats involving the number of inserted tuples). Also
remove the vacuum_cleanup_index_scale_factor GUC/param on the master
branch (though just disable them on postgres 13).
The vacuum_cleanup_index_scale_factor/stats interface made the nbtree AM
partially responsible for deciding when pg_class.reltuples stats needed
to be updated. This seems contrary to the spirit of the index AM API,
though -- it is not actually necessary for an index AM's bulk delete and
cleanup callbacks to provide accurate stats when it happens to be
inconvenient. The core code owns that. (Index AMs have the authority
to perform or not perform certain kinds of deferred cleanup based on
their own considerations, such as page deletion and recycling, but that
has little to do with pg_class.reltuples/num_index_tuples.)
This issue was fairly harmless until the introduction of the
autovacuum_vacuum_insert_threshold feature by commit b07642db, which had
an undesirable interaction with the vacuum_cleanup_index_scale_factor
mechanism: it made insert-driven autovacuums perform full index scans,
even though there is no real benefit to doing so. This has been tied to
a regression with an append-only insert benchmark [1].
Also have remaining cases that perform a full scan of an index during a
cleanup-only nbtree VACUUM indicate that the final tuple count is only
an estimate. This prevents vacuumlazy.c from setting the index's
pg_class.reltuples in those cases (it will now only update pg_class when
vacuumlazy.c had TIDs for nbtree to bulk delete). This arguably fixes
an oversight in deduplication-related bugfix commit 48e12913.
[1] https://smalldatum.blogspot.com/2021/01/insert-benchmark-postgres-is-still.html
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAD21AoA4WHthN5uU6+WScZ7+J_RcEjmcuH94qcoUPuB42ShXzg@mail.gmail.com
Backpatch: 13-, where autovacuum_vacuum_insert_threshold was added.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 40 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_index.sgml | 14 |
2 files changed, 0 insertions, 54 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 529876895b8..a218d78bef4 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -8544,46 +8544,6 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; </listitem> </varlistentry> - <varlistentry id="guc-vacuum-cleanup-index-scale-factor" xreflabel="vacuum_cleanup_index_scale_factor"> - <term><varname>vacuum_cleanup_index_scale_factor</varname> (<type>floating point</type>) - <indexterm> - <primary><varname>vacuum_cleanup_index_scale_factor</varname></primary> - <secondary>configuration parameter</secondary> - </indexterm> - </term> - <listitem> - <para> - Specifies the fraction of the total number of heap tuples counted in - the previous statistics collection that can be inserted without - incurring an index scan at the <command>VACUUM</command> cleanup stage. - This setting currently applies to B-tree indexes only. - </para> - - <para> - If no tuples were deleted from the heap, B-tree indexes are still - scanned at the <command>VACUUM</command> cleanup stage when the - index's statistics are stale. Index statistics are considered - stale if the number of newly inserted tuples exceeds the - <varname>vacuum_cleanup_index_scale_factor</varname> - fraction of the total number of heap tuples detected by the previous - statistics collection. The total number of heap tuples is stored in - the index meta-page. Note that the meta-page does not include this data - until <command>VACUUM</command> finds no dead tuples, so B-tree index - scan at the cleanup stage can only be skipped if the second and - subsequent <command>VACUUM</command> cycles detect no dead tuples. - </para> - - <para> - The value can range from <literal>0</literal> to - <literal>10000000000</literal>. - When <varname>vacuum_cleanup_index_scale_factor</varname> is set to - <literal>0</literal>, index scans are never skipped during - <command>VACUUM</command> cleanup. The default value is <literal>0.1</literal>. - </para> - - </listitem> - </varlistentry> - <varlistentry id="guc-bytea-output" xreflabel="bytea_output"> <term><varname>bytea_output</varname> (<type>enum</type>) <indexterm> diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index 51b4d579399..bc57adf7d59 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -456,20 +456,6 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class= </note> </listitem> </varlistentry> - - <varlistentry id="index-reloption-vacuum-cleanup-index-scale-factor" xreflabel="vacuum_cleanup_index_scale_factor"> - <term><literal>vacuum_cleanup_index_scale_factor</literal> (<type>floating point</type>) - <indexterm> - <primary><varname>vacuum_cleanup_index_scale_factor</varname></primary> - <secondary>storage parameter</secondary> - </indexterm> - </term> - <listitem> - <para> - Per-index value for <xref linkend="guc-vacuum-cleanup-index-scale-factor"/>. - </para> - </listitem> - </varlistentry> </variablelist> <para> |