Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9a994e3

Browse files
committed
Fixes for vacuum_cleanup_index_scale_factor GUC option
vacuum_cleanup_index_scale_factor was located in autovacuum group of GUCs. However, it affects not only autovacuum, but also manually run VACUUM. It appears that "client connection defaults" group of GUCs is more appropriate for vacuum_cleanup_index_scale_factor, because vacuum_*_age options are already located there. Also, vacuum_cleanup_index_scale_factor was missed in postgresql.conf.sample. So, add it there with appropriate comment. Author: Masahiko Sawada with minor editorization by me Discussion: https://postgr.es/m/CAD21AoArsoXMLKudXSKN679FRzs6oubEchM53bHwn8Tp%3D2boNg%40mail.gmail.com
1 parent 0aa5e65 commit 9a994e3

File tree

3 files changed

+43
-45
lines changed

3 files changed

+43
-45
lines changed

doc/src/sgml/config.sgml

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,50 +1882,6 @@ include_dir 'conf.d'
18821882
</note>
18831883
</sect2>
18841884

1885-
<sect2 id="runtime-config-index-vacuum">
1886-
<title>Index Vacuum</title>
1887-
<variablelist>
1888-
<varlistentry id="guc-vacuum-cleanup-index-scale-factor" xreflabel="vacuum_cleanup_index_scale_factor">
1889-
<term><varname>vacuum_cleanup_index_scale_factor</varname> (<type>floating point</type>)
1890-
<indexterm>
1891-
<primary><varname>vacuum_cleanup_index_scale_factor</varname> configuration parameter</primary>
1892-
</indexterm>
1893-
</term>
1894-
<listitem>
1895-
<para>
1896-
Specifies the fraction of the total number of heap tuples counted in
1897-
the previous statistics collection that can be inserted without
1898-
incurring an index scan at the <command>VACUUM</command> cleanup stage.
1899-
This setting currently applies to B-tree indexes only.
1900-
</para>
1901-
1902-
<para>
1903-
If no tuples were deleted from the heap, B-tree indexes are still
1904-
scanned at the <command>VACUUM</command> cleanup stage when at least one
1905-
of the following conditions is met: the index statistics are stale, or
1906-
the index contains deleted pages that can be recycled during cleanup.
1907-
Index statistics are considered to be stale if the number of newly
1908-
inserted tuples exceeds the <varname>vacuum_cleanup_index_scale_factor</varname>
1909-
fraction of the total number of heap tuples detected by the previous
1910-
statistics collection. The total number of heap tuples is stored in
1911-
the index meta-page. Note that the meta-page does not include this data
1912-
until <command>VACUUM</command> finds no dead tuples, so B-tree index
1913-
scan at the cleanup stage can only be skipped if the second and
1914-
subsequent <command>VACUUM</command> cycles detect no dead tuples.
1915-
</para>
1916-
1917-
<para>
1918-
The value can range from <literal>0</literal> to <literal>100</literal>.
1919-
When <varname>vacuum_cleanup_index_scale_factor</varname> is set to
1920-
<literal>0</literal>, index scans are never skipped during
1921-
<command>VACUUM</command> cleanup. The default value is <literal>0.1</literal>.
1922-
</para>
1923-
1924-
</listitem>
1925-
</varlistentry>
1926-
</variablelist>
1927-
</sect2>
1928-
19291885
<sect2 id="runtime-config-resource-background-writer">
19301886
<title>Background Writer</title>
19311887

@@ -7003,6 +6959,45 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
70036959
</listitem>
70046960
</varlistentry>
70056961

6962+
<varlistentry id="guc-vacuum-cleanup-index-scale-factor" xreflabel="vacuum_cleanup_index_scale_factor">
6963+
<term><varname>vacuum_cleanup_index_scale_factor</varname> (<type>floating point</type>)
6964+
<indexterm>
6965+
<primary><varname>vacuum_cleanup_index_scale_factor</varname> configuration parameter</primary>
6966+
</indexterm>
6967+
</term>
6968+
<listitem>
6969+
<para>
6970+
Specifies the fraction of the total number of heap tuples counted in
6971+
the previous statistics collection that can be inserted without
6972+
incurring an index scan at the <command>VACUUM</command> cleanup stage.
6973+
This setting currently applies to B-tree indexes only.
6974+
</para>
6975+
6976+
<para>
6977+
If no tuples were deleted from the heap, B-tree indexes are still
6978+
scanned at the <command>VACUUM</command> cleanup stage when at least one
6979+
of the following conditions is met: the index statistics are stale, or
6980+
the index contains deleted pages that can be recycled during cleanup.
6981+
Index statistics are considered to be stale if the number of newly
6982+
inserted tuples exceeds the <varname>vacuum_cleanup_index_scale_factor</varname>
6983+
fraction of the total number of heap tuples detected by the previous
6984+
statistics collection. The total number of heap tuples is stored in
6985+
the index meta-page. Note that the meta-page does not include this data
6986+
until <command>VACUUM</command> finds no dead tuples, so B-tree index
6987+
scan at the cleanup stage can only be skipped if the second and
6988+
subsequent <command>VACUUM</command> cycles detect no dead tuples.
6989+
</para>
6990+
6991+
<para>
6992+
The value can range from <literal>0</literal> to <literal>100</literal>.
6993+
When <varname>vacuum_cleanup_index_scale_factor</varname> is set to
6994+
<literal>0</literal>, index scans are never skipped during
6995+
<command>VACUUM</command> cleanup. The default value is <literal>0.1</literal>.
6996+
</para>
6997+
6998+
</listitem>
6999+
</varlistentry>
7000+
70067001
<varlistentry id="guc-bytea-output" xreflabel="bytea_output">
70077002
<term><varname>bytea_output</varname> (<type>enum</type>)
70087003
<indexterm>

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3248,7 +3248,7 @@ static struct config_real ConfigureNamesReal[] =
32483248
},
32493249

32503250
{
3251-
{"vacuum_cleanup_index_scale_factor", PGC_USERSET, AUTOVACUUM,
3251+
{"vacuum_cleanup_index_scale_factor", PGC_USERSET, CLIENT_CONN_STATEMENT,
32523252
gettext_noop("Number of tuple inserts prior to index cleanup as a fraction of reltuples."),
32533253
NULL
32543254
},

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@
575575
#vacuum_freeze_table_age = 150000000
576576
#vacuum_multixact_freeze_min_age = 5000000
577577
#vacuum_multixact_freeze_table_age = 150000000
578+
#vacuum_cleanup_index_scale_factor = 0.1 # fraction of total number of tuples
579+
# before index cleanup, 0 always performs
580+
# index cleanup
578581
#bytea_output = 'hex' # hex, escape
579582
#xmlbinary = 'base64'
580583
#xmloption = 'content'

0 commit comments

Comments
 (0)