diff options
author | David Rowley | 2023-04-06 23:40:31 +0000 |
---|---|---|
committer | David Rowley | 2023-04-06 23:40:31 +0000 |
commit | 1cbbee03385763b066ae3961fc61f2cd01a0d0d7 (patch) | |
tree | dbc0fc9f326d9622860592e18c49937247ef04f4 /doc | |
parent | 5279e9db8e8da3c310c0068da2de98df5a714b2e (diff) |
Add VACUUM/ANALYZE BUFFER_USAGE_LIMIT option
Add new options to the VACUUM and ANALYZE commands called
BUFFER_USAGE_LIMIT to allow users more control over how large to make the
buffer access strategy that is used to limit the usage of buffers in
shared buffers. Larger rings can allow VACUUM to run more quickly but
have the drawback of VACUUM possibly evicting more buffers from shared
buffers that might be useful for other queries running on the database.
Here we also add a new GUC named vacuum_buffer_usage_limit which controls
how large to make the access strategy when it's not specified in the
VACUUM/ANALYZE command. This defaults to 256KB, which is the same size as
the access strategy was prior to this change. This setting also
controls how large to make the buffer access strategy for autovacuum.
Per idea by Andres Freund.
Author: Melanie Plageman
Reviewed-by: David Rowley
Reviewed-by: Andres Freund
Reviewed-by: Justin Pryzby
Reviewed-by: Bharath Rupireddy
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/sgml/config.sgml | 30 | ||||
-rw-r--r-- | doc/src/sgml/ref/analyze.sgml | 20 | ||||
-rw-r--r-- | doc/src/sgml/ref/vacuum.sgml | 24 |
3 files changed, 74 insertions, 0 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index bcc49aec45..992e944001 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2001,6 +2001,36 @@ include_dir 'conf.d' </listitem> </varlistentry> + <varlistentry id="guc-vacuum-buffer-usage-limit" xreflabel="vacuum_buffer_usage_limit"> + <term> + <varname>vacuum_buffer_usage_limit</varname> (<type>integer</type>) + <indexterm> + <primary><varname>vacuum_buffer_usage_limit</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Specifies the size of the + <glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm> + used by the <command>VACUUM</command> and <command>ANALYZE</command> + commands. A setting of <literal>0</literal> will allow the operation + to use any number of <varname>shared_buffers</varname>. Otherwise + valid sizes range from <literal>128 KB</literal> to + <literal>16 GB</literal>. If the specified size would exceed 1/8 the + size of <varname>shared_buffers</varname>, the size is silently capped + to that value. The default value is <literal>256 KB</literal>. If + this value is specified without units, it is taken as kilobytes. This + parameter can be set at any time. It can be overridden for + <xref linkend="sql-vacuum"/> and <xref linkend="sql-analyze"/> + when passing the <option>BUFFER_USAGE_LIMIT</option> option. Higher + settings can allow <command>VACUUM</command> and + <command>ANALYZE</command> to run more quickly, but having too large a + setting may cause too many other useful pages to be evicted from + shared buffers. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-logical-decoding-work-mem" xreflabel="logical_decoding_work_mem"> <term><varname>logical_decoding_work_mem</varname> (<type>integer</type>) <indexterm> diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml index 2f94e89cb0..94e30f1ce7 100644 --- a/doc/src/sgml/ref/analyze.sgml +++ b/doc/src/sgml/ref/analyze.sgml @@ -28,6 +28,7 @@ ANALYZE [ VERBOSE ] [ <replaceable class="parameter">table_and_columns</replacea VERBOSE [ <replaceable class="parameter">boolean</replaceable> ] SKIP_LOCKED [ <replaceable class="parameter">boolean</replaceable> ] + BUFFER_USAGE_LIMIT [ <replaceable class="parameter">string</replaceable> ] <phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase> @@ -96,6 +97,25 @@ ANALYZE [ VERBOSE ] [ <replaceable class="parameter">table_and_columns</replacea </varlistentry> <varlistentry> + <term><literal>BUFFER_USAGE_LIMIT</literal></term> + <listitem> + <para> + Specifies the + <glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm> + ring buffer size for <command>ANALYZE</command>. This size is used to + calculate the number of shared buffers which will be reused as part of + this strategy. <literal>0</literal> disables use of a + <literal>Buffer Access Strategy</literal>. When this option is not + specified, <command>ANALYZE</command> uses the value from + <xref linkend="guc-vacuum-buffer-usage-limit"/>. Higher settings can + allow <command>ANALYZE</command> to run more quickly, but having too + large a setting may cause too many other useful pages to be evicted from + shared buffers. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">boolean</replaceable></term> <listitem> <para> diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index b6d30b5764..dd0fbb8cb7 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -39,6 +39,7 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet PARALLEL <replaceable class="parameter">integer</replaceable> SKIP_DATABASE_STATS [ <replaceable class="parameter">boolean</replaceable> ] ONLY_DATABASE_STATS [ <replaceable class="parameter">boolean</replaceable> ] + BUFFER_USAGE_LIMIT [ <replaceable class="parameter">string</replaceable> ] <phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase> @@ -346,6 +347,29 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet </varlistentry> <varlistentry> + <term><literal>BUFFER_USAGE_LIMIT</literal></term> + <listitem> + <para> + Specifies the + <glossterm linkend="glossary-buffer-access-strategy">Buffer Access Strategy</glossterm> + ring buffer size for <command>VACUUM</command>. This size is used to + calculate the number of shared buffers which will be reused as part of + this strategy. <literal>0</literal> disables use of a + <literal>Buffer Access Strategy</literal>. If <option>ANALYZE</option> + is also specified, the <option>BUFFER_USAGE_LIMIT</option> value is used + for both the vacuum and analyze stages. This option can't be used with + the <option>FULL</option> option except if <option>ANALYZE</option> is + also specified. When this option is not specified, + <command>VACUUM</command> uses the value from + <xref linkend="guc-vacuum-buffer-usage-limit"/>. Higher settings can + allow <command>VACUUM</command> to run more quickly, but having too + large a setting may cause too many other useful pages to be evicted from + shared buffers. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">boolean</replaceable></term> <listitem> <para> |