diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 18 | ||||
-rw-r--r-- | doc/src/sgml/ref/vacuum.sgml | 61 |
2 files changed, 65 insertions, 14 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 5d45b6f7cba..3ccacd528b4 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2308,13 +2308,13 @@ include_dir 'conf.d' <listitem> <para> Sets the maximum number of parallel workers that can be - started by a single utility command. Currently, the only - parallel utility command that supports the use of parallel - workers is <command>CREATE INDEX</command>, and only when - building a B-tree index. Parallel workers are taken from the - pool of processes established by <xref - linkend="guc-max-worker-processes"/>, limited by <xref - linkend="guc-max-parallel-workers"/>. Note that the requested + started by a single utility command. Currently, the parallel + utility commands that support the use of parallel workers are + <command>CREATE INDEX</command> only when building a B-tree index, + and <command>VACUUM</command> without <literal>FULL</literal> + option. Parallel workers are taken from the pool of processes + established by <xref linkend="guc-max-worker-processes"/>, limited + by <xref linkend="guc-max-parallel-workers"/>. Note that the requested number of workers may not actually be available at run time. If this occurs, the utility operation will run with fewer workers than expected. The default value is 2. Setting this @@ -4915,7 +4915,9 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class=" for a parallel scan to be considered. Note that a parallel index scan typically won't touch the entire index; it is the number of pages which the planner believes will actually be touched by the scan which - is relevant. + is relevant. This parameter is also used to decide whether a + particular index can participate in a parallel vacuum. See + <xref linkend="sql-vacuum"/>. If this value is specified without units, it is taken as blocks, that is <symbol>BLCKSZ</symbol> bytes, typically 8kB. The default is 512 kilobytes (<literal>512kB</literal>). diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index f9b0fb87945..846056a353d 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -34,6 +34,7 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet SKIP_LOCKED [ <replaceable class="parameter">boolean</replaceable> ] INDEX_CLEANUP [ <replaceable class="parameter">boolean</replaceable> ] TRUNCATE [ <replaceable class="parameter">boolean</replaceable> ] + PARALLEL <replaceable class="parameter">integer</replaceable> <phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase> @@ -75,10 +76,14 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet with normal reading and writing of the table, as an exclusive lock is not obtained. However, extra space is not returned to the operating system (in most cases); it's just kept available for re-use within the - same table. <command>VACUUM FULL</command> rewrites the entire contents - of the table into a new disk file with no extra space, allowing unused - space to be returned to the operating system. This form is much slower and - requires an exclusive lock on each table while it is being processed. + same table. It also allows us to leverage multiple CPUs in order to process + indexes. This feature is known as <firstterm>parallel vacuum</firstterm>. + To disable this feature, one can use <literal>PARALLEL</literal> option and + specify parallel workers as zero. <command>VACUUM FULL</command> rewrites + the entire contents of the table into a new disk file with no extra space, + allowing unused space to be returned to the operating system. This form is + much slower and requires an exclusive lock on each table while it is being + processed. </para> <para> @@ -224,6 +229,33 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet </varlistentry> <varlistentry> + <term><literal>PARALLEL</literal></term> + <listitem> + <para> + Perform vacuum index and cleanup index phases of <command>VACUUM</command> + in parallel using <replaceable class="parameter">integer</replaceable> + background workers (for the detail of each vacuum phases, please + refer to <xref linkend="vacuum-phases"/>). If the + <literal>PARALLEL</literal> option is omitted, then + <command>VACUUM</command> decides the number of workers based on number + of indexes that support parallel vacuum operation on the relation which + is further limited by <xref linkend="guc-max-parallel-workers-maintenance"/>. + The index can participate in a parallel vacuum if and only if the size + of the index is more than <xref linkend="guc-min-parallel-index-scan-size"/>. + Please note that it is not guaranteed that the number of parallel workers + specified in <replaceable class="parameter">integer</replaceable> will + be used during execution. It is possible for a vacuum to run with fewer + workers than specified, or even with no workers at all. Only one worker + can be used per index. So parallel workers are launched only when there + are at least <literal>2</literal> indexes in the table. Workers for + vacuum launches before starting each phase and exit at the end of + the phase. These behaviors might change in a future release. This + option can't be used with the <literal>FULL</literal> option. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">boolean</replaceable></term> <listitem> <para> @@ -238,6 +270,15 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet </varlistentry> <varlistentry> + <term><replaceable class="parameter">integer</replaceable></term> + <listitem> + <para> + Specifies a non-negative integer value passed to the selected option. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">table_name</replaceable></term> <listitem> <para> @@ -317,10 +358,18 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet </para> <para> + The <option>PARALLEL</option> option is used only for vacuum purpose. + Even if this option is specified with <option>ANALYZE</option> option + it does not affect <option>ANALYZE</option>. + </para> + + <para> <command>VACUUM</command> causes a substantial increase in I/O traffic, which might cause poor performance for other active sessions. Therefore, - it is sometimes advisable to use the cost-based vacuum delay feature. - See <xref linkend="runtime-config-resource-vacuum-cost"/> for details. + it is sometimes advisable to use the cost-based vacuum delay feature. For + parallel vacuum, each worker sleeps proportional to the work done by that + worker. See <xref linkend="runtime-config-resource-vacuum-cost"/> for + details. </para> <para> |