aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/vacuum.sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/ref/vacuum.sgml')
-rw-r--r--doc/src/sgml/ref/vacuum.sgml61
1 files changed, 55 insertions, 6 deletions
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>