@@ -51,7 +51,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
51
51
ANALYZE [ <replaceable class="parameter">boolean</replaceable> ]
52
52
DISABLE_PAGE_SKIPPING [ <replaceable class="parameter">boolean</replaceable> ]
53
53
SKIP_LOCKED [ <replaceable class="parameter">boolean</replaceable> ]
54
- INDEX_CLEANUP [ <replaceable class="parameter">boolean</replaceable> ]
54
+ INDEX_CLEANUP { AUTO | ON | OFF }
55
+ PROCESS_TOAST [ <replaceable class="parameter">boolean</replaceable> ]
55
56
TRUNCATE [ <replaceable class="parameter">boolean</replaceable> ]
56
57
PARALLEL <replaceable class="parameter">integer</replaceable>
57
58
@@ -72,7 +73,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
72
73
ANALYZE [ <replaceable class="parameter">boolean</replaceable> ]
73
74
DISABLE_PAGE_SKIPPING [ <replaceable class="parameter">boolean</replaceable> ]
74
75
SKIP_LOCKED [ <replaceable class="parameter">boolean</replaceable> ]
75
- INDEX_CLEANUP [ <replaceable class="parameter">boolean</replaceable> ]
76
+ INDEX_CLEANUP { AUTO | ON | OFF }
77
+ PROCESS_TOAST [ <replaceable class="parameter">boolean</replaceable> ]
76
78
TRUNCATE [ <replaceable class="parameter">boolean</replaceable> ]
77
79
PARALLEL <replaceable class="parameter">integer</replaceable>
78
80
@@ -141,12 +143,18 @@ ____________________________________________________________________________-->
141
143
specify parallel workers as zero. <command>VACUUM FULL</command> rewrites
142
144
the entire contents of the table into a new disk file with no extra space,
143
145
allowing unused space to be returned to the operating system. This form is
144
- much slower and requires an exclusive lock on each table while it is being
145
- processed.
146
+ much slower and requires an <literal>ACCESS EXCLUSIVE</literal> lock on
147
+ each table while it is being processed.
146
148
</para>
147
149
____________________________________________________________________________-->
148
150
<para>
149
- 简单的 <command>VACUUM</command>(不带<literal>FULL</literal>)简单地收回空间并使其可以被重用。这种形式的命令可以和表的普通读写操作并行,因为它不会获得一个排他锁。但是,这种形式中额外的空间并没有被还给操作系统(在大多数情况下),它仅仅被保留在同一个表中以备重用。它还允许我们利用多个 CPU 来处理索引。 此功能称为<firstterm>parallel vacuum</firstterm>。要禁用此功能,可以使用<literal>PARALLEL</literal>选项并将并行工作程序指定为零。<command>VACUUM FULL</command>将表的整个内容重写到一个新的磁盘文件中,并且不包含额外的空间,这使得没有被使用的空间被还给操作系统。这种形式的命令更慢并且在其被处理时要求在每个表上保持一个排他锁。
151
+ 简单的 <command>VACUUM</command>(不带<literal>FULL</literal>)简单地收回空间并使其可以被重用。
152
+ 这种形式的命令可以和表的普通读写操作并行,因为它不会获得一个排他锁。
153
+ 但是,这种形式中额外的空间并没有被还给操作系统(在大多数情况下),它仅仅被保留在同一个表中以备重用。
154
+ 它还允许我们利用多个 CPU 来处理索引。 此功能称为<firstterm>parallel vacuum</firstterm>。
155
+ 要禁用此功能,可以使用<literal>PARALLEL</literal>选项并将并行工作程序指定为零。
156
+ <command>VACUUM FULL</command>将表的整个内容重写到一个新的磁盘文件中,并且不包含额外的空间,这使得没有被使用的空间被还给操作系统。
157
+ 这种形式的命令更慢并且在其被处理时要求在每个表上保持一个<literal>ACCESS EXCLUSIVE</literal> 锁。
150
158
</para>
151
159
152
160
<!--==========================orignal english content==========================
@@ -322,28 +330,97 @@ ____________________________________________________________________________-->
322
330
<listitem>
323
331
<!--==========================orignal english content==========================
324
332
<para>
325
- Specifies that <command>VACUUM</command> should attempt to remove
326
- index entries pointing to dead tuples. This is normally the desired
327
- behavior and is the default unless the
328
- <literal>vacuum_index_cleanup</literal> option has been set to false
329
- for the table to be vacuumed. Setting this option to false may be
330
- useful when it is necessary to make vacuum run as quickly as possible,
331
- for example to avoid imminent transaction ID wraparound
332
- (see <xref linkend="vacuum-for-wraparound"/>). However, if index
333
- cleanup is not performed regularly, performance may suffer, because
334
- as the table is modified, indexes will accumulate dead tuples
335
- and the table itself will accumulate dead line pointers that cannot be
336
- removed until index cleanup is completed. This option has no effect
337
- for tables that do not have an index and is ignored if the
333
+ Normally, <command>VACUUM</command> will skip index vacuuming
334
+ when there are very few dead tuples in the table. The cost of
335
+ processing all of the table's indexes is expected to greatly
336
+ exceed the benefit of removing dead index tuples when this
337
+ happens. This option can be used to force
338
+ <command>VACUUM</command> to process indexes when there are more
339
+ than zero dead tuples. The default is <literal>AUTO</literal>,
340
+ which allows <command>VACUUM</command> to skip index vacuuming
341
+ when appropriate. If <literal>INDEX_CLEANUP</literal> is set to
342
+ <literal>ON</literal>, <command>VACUUM</command> will
343
+ conservatively remove all dead tuples from indexes. This may be
344
+ useful for backwards compatibility with earlier releases of
345
+ <productname>PostgreSQL</productname> where this was the
346
+ standard behavior.
347
+ </para>
348
+ ____________________________________________________________________________-->
349
+ <para>
350
+ 通常,当表中的死亡元组很少时,<command>VACUUM</command>将跳过索引清理。
351
+ 处理全部表索引的成本预计将大大超过删除死索引元组的好处,当这发生时。
352
+ 当多于零个死元组时,此选项可用于强制<command>VACUUM</command>处理索引。
353
+ 默认值是<literal>AUTO</literal>,这允许<command>VACUUM</command>在适当的时候略过索引清理。
354
+ 如果<literal>INDEX_CLEANUP</literal>设置为<literal>ON</literal>,<command>VACUUM</command>将适当地从索引中删除所有死元组。
355
+ 这对于向后兼容<productname>PostgreSQL</productname>的早期版本是很有用的,在那里这是标准的行为。
356
+ </para>
357
+ <!--==========================orignal english content==========================
358
+ <para>
359
+ <literal>INDEX_CLEANUP</literal> can also be set to
360
+ <literal>OFF</literal> to force <command>VACUUM</command> to
361
+ <emphasis>always</emphasis> skip index vacuuming, even when
362
+ there are many dead tuples in the table. This may be useful
363
+ when it is necessary to make <command>VACUUM</command> run as
364
+ quickly as possible to avoid imminent transaction ID wraparound
365
+ (see <xref linkend="vacuum-for-wraparound"/>). However, the
366
+ wraparound failsafe mechanism controlled by <xref
367
+ linkend="guc-vacuum-failsafe-age"/> will generally trigger
368
+ automatically to avoid transaction ID wraparound failure, and
369
+ should be preferred. If index cleanup is not performed
370
+ regularly, performance may suffer, because as the table is
371
+ modified indexes will accumulate dead tuples and the table
372
+ itself will accumulate dead line pointers that cannot be removed
373
+ until index cleanup is completed.
374
+ </para>
375
+ ____________________________________________________________________________-->
376
+ <para>
377
+ <literal>INDEX_CLEANUP</literal>也可以设置为<literal>OFF</literal>来强制<command>VACUUM</command> <emphasis>总是</emphasis> 略过索引清理,即使表中有许多死元组。
378
+ 当需要使<command>VACUUM</command>尽可能快地运行,以避免临近的事务ID回卷时,这可能很有用(参见<xref linkend="vacuum-for-wraparound"/>)。
379
+ 然而,由<xref linkend="guc-vacuum-failsafe-age"/>控制的回卷失效保护机制通常会自动触发,以避免事务ID回卷失败,并且将被优先考虑。
380
+ 如果索引清理不被定期执行,性能可能会变差,
381
+ 因为当表被修改时,索引会累积死元组,并且表自己也会累积死线指针,这些在索引清理完成之前无法删除。
382
+ </para>
383
+ <!--==========================orignal english content==========================
384
+ <para>
385
+ This option has no effect for tables that have no index and is
386
+ ignored if the <literal>FULL</literal> option is used. It also
387
+ has no effect on the transaction ID wraparound failsafe
388
+ mechanism. When triggered it will skip index vacuuming, even
389
+ when <literal>INDEX_CLEANUP</literal> is set to
390
+ <literal>ON</literal>.
391
+ </para>
392
+ ____________________________________________________________________________-->
393
+ <para>
394
+ 该选项对没有索引的表无影响,并且如果使用了<literal>FULL</literal>选项就会被忽略。
395
+ 它对事务ID回卷失效保护机制也没有影响。
396
+ 当触发它时会略过索引抽清理,即使<literal>INDEX_CLEANUP</literal>设置为<literal>ON</literal>。
397
+ </para>
398
+ </listitem>
399
+ </varlistentry>
400
+
401
+ <varlistentry>
402
+ <!--==========================orignal english content==========================
403
+ <term><literal>PROCESS_TOAST</literal></term>
404
+ ____________________________________________________________________________-->
405
+ <term><literal>PROCESS_TOAST</literal></term>
406
+ <listitem>
407
+ <!--==========================orignal english content==========================
408
+ <para>
409
+ Specifies that <command>VACUUM</command> should attempt to process the
410
+ corresponding <literal>TOAST</literal> table for each relation, if one
411
+ exists. This is usually the desired behavior and is the default.
412
+ Setting this option to false may be useful when it is only necessary to
413
+ vacuum the main relation. This option is required when the
338
414
<literal>FULL</literal> option is used.
339
415
</para>
340
416
____________________________________________________________________________-->
341
417
<para>
342
- 规定<command>VACUUM</command>尝试删除指向死元组的索引条目。
343
- 这通常是所需的行为,并且是默认行为,除非将<literal>vacuum_index_cleanup</literal> 选项设置为 false,对要被清空的表。
344
- 如果需要尽快运行清空操作的话,将此选项设置为 false 可能很有用,例如,为了避免即将发生的事务 ID 回绕[wraparound](请参阅 <xref linkend="vacuum-for-wraparound"/>)。
345
- 但是,如果不定期执行索引清理,性能可能会受到影响,因为随着表的修改,索引将累积死元组,并且表本身将累积死行指针,在索引清理完成之前都无法删除。
346
- 此选项对于没有索引的表无效,如果使用 <literal>FULL</literal> 选项,则忽略此选项。
418
+ Specifies that <command>VACUUM</command> should attempt to process the
419
+ corresponding <literal>TOAST</literal> table for each relation, if one
420
+ exists. This is usually the desired behavior and is the default.
421
+ Setting this option to false may be useful when it is only necessary to
422
+ vacuum the main relation. This option is required when the
423
+ <literal>FULL</literal> option is used.
347
424
</para>
348
425
</listitem>
349
426
</varlistentry>
@@ -391,7 +468,7 @@ ____________________________________________________________________________-->
391
468
to perform the operation is equal to the number of indexes on the
392
469
relation that support parallel vacuum which is limited by the number of
393
470
workers specified with <literal>PARALLEL</literal> option if any which is
394
- further limited by <xref linkend="guc-max-parallel-workers- maintenance"/>.
471
+ further limited by <xref linkend="guc-max-parallel-maintenance-workers "/>.
395
472
An index can participate in parallel vacuum if and only if the size of the
396
473
index is more than <xref linkend="guc-min-parallel-index-scan-size"/>.
397
474
Please note that it is not guaranteed that the number of parallel workers
@@ -409,7 +486,7 @@ ____________________________________________________________________________-->
409
486
使用<replaceable class="parameter">integer</replaceable>后台处理器并行执行<command>VACUUM</command>
410
487
的索引真空和索引清理阶段(每个真空阶段的详细信息请参考<xref linkend="vacuum-phases"/>))。
411
488
用于执行操作的处理器数量等于关系上支持并行清理的索引数量,该数量受<literal>PARALLEL</literal>
412
- 选项指定的工人数量的限制,如果有的话,该数量还受到<xref linkend="guc-max-parallel-workers- maintenance"/>限制。
489
+ 选项指定的工人数量的限制,如果有的话,该数量还受到<xref linkend="guc-max-parallel-maintenance-workers "/>限制。
413
490
当且仅当索引的大小大于<xref linkend="guc-min-parallel-index-scan-size"/>时,索引才能参与并行清理。
414
491
请注意,不保证在执行期间会使用<replaceable class="parameter">integer</replaceable>中指定的并行工作线程数。
415
492
清理运行时可能需要比指定的更少的处理器,甚至根本没有处理器。每个索引只能使用一名处理器。
@@ -627,6 +704,22 @@ ____________________________________________________________________________-->
627
704
<para>
628
705
<productname>PostgreSQL</productname>包括了一个<quote>autovacuum</quote>工具,它可以自动进行例行的清理维护。关于自动和手动清理的更多信息请见<xref linkend="routine-vacuuming"/>。
629
706
</para>
707
+ <!--==========================orignal english content==========================
708
+ <para>
709
+ Each backend running <command>VACUUM</command> without the
710
+ <literal>FULL</literal> option will report its progress in the
711
+ <structname>pg_stat_progress_vacuum</structname> view. Backends running
712
+ <command>VACUUM FULL</command> will instead report their progress in the
713
+ <structname>pg_stat_progress_cluster</structname> view. See
714
+ <xref linkend="vacuum-progress-reporting"/> and
715
+ <xref linkend="cluster-progress-reporting"/> for details.
716
+ </para>
717
+ ____________________________________________________________________________-->
718
+ <para>
719
+ 每个后端运行没有<literal>FULL</literal>选项的<command>VACUUM</command>时,将在<structname>pg_stat_progress_vacuum</structname>视图中报告它的进度。
720
+ 运行<command>VACUUM FULL</command>的后端将改为在<structname>pg_stat_progress_cluster</structname>视图中报告它的进度。
721
+ 详见<xref linkend="vacuum-progress-reporting"/> 和 <xref linkend="cluster-progress-reporting"/>。
722
+ </para>
630
723
</refsect1>
631
724
632
725
<refsect1>
@@ -678,6 +771,8 @@ ____________________________________________________________________________-->
678
771
<member><xref linkend="app-vacuumdb"/></member>
679
772
<member><xref linkend="runtime-config-resource-vacuum-cost"/></member>
680
773
<member><xref linkend="autovacuum"/></member>
774
+ <member><xref linkend="vacuum-progress-reporting"/></member>
775
+ <member><xref linkend="cluster-progress-reporting"/></member>
681
776
</simplelist>
682
777
</refsect1>
683
778
</refentry>
0 commit comments