Skip to content

Commit 1860968

Browse files
committed
update 6 files
1 parent 321a217 commit 1860968

File tree

6 files changed

+519
-174
lines changed

6 files changed

+519
-174
lines changed

postgresql/doc/src/sgml/ref/truncate.sgml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,17 @@ ____________________________________________________________________________-->
266266
</para>
267267

268268
<!--==========================orignal english content==========================
269-
<para>
269+
<para>
270270
<command>TRUNCATE</command> is not MVCC-safe. After truncation, the table will
271271
appear empty to concurrent transactions, if they are using a snapshot
272272
taken before the truncation occurred.
273273
See <xref linkend="mvcc-caveats"/> for more details.
274274
</para>
275275
____________________________________________________________________________-->
276-
<para>
277-
<command>TRUNCATE</command>不是 MVCC 安全的。截断之后,
278-
如果并发事务使用的是一个在截断发生前取得的快照,
279-
表将对这些并发事务呈现为空。详见<xref linkend="mvcc-caveats"/>。
276+
<para>
277+
<command>TRUNCATE</command>不是 MVCC 安全的。截断之后,
278+
如果并发事务使用的是一个在截断发生前取得的快照,
279+
表将对这些并发事务呈现为空。详见<xref linkend="mvcc-caveats"/>。
280280
</para>
281281

282282
<!--==========================orignal english content==========================
@@ -317,17 +317,16 @@ ____________________________________________________________________________-->
317317
最后一个序列值,即使序列本身可能已经不再与此一致。这和失败事务之后
318318
<function>currval()</function>的通常行为类似。
319319
</para>
320-
320+
321321
<!--==========================orignal english content==========================
322322
<para>
323-
<command>TRUNCATE</command> is not currently supported for foreign tables.
324-
This implies that if a specified table has any descendant tables that are
325-
foreign, the command will fail.
323+
<command>TRUNCATE</command> can be used for foreign tables if
324+
supported by the foreign data wrapper, for instance,
325+
see <xref linkend="postgres-fdw"/>.
326326
</para>
327327
____________________________________________________________________________-->
328328
<para>
329-
<command>TRUNCATE</command>当前不支持外部表。
330-
这表示如果一个指定的表具有任何外部的后代表,这个命令将会失败。
329+
<command>TRUNCATE</command>当前不能用于被发布封装器支持的外部表,相应示例,参见<xref linkend="postgres-fdw"/>。
331330
</para>
332331
</refsect1>
333332

@@ -422,12 +421,12 @@ ____________________________________________________________________________-->
422421

423422
<refsect1>
424423
<!--==========================orignal english content==========================
425-
<title>See Also</title>
424+
<title>See Also</title>
426425
____________________________________________________________________________-->
427-
<title>参见</title>
426+
<title>参见</title>
428427

429-
<simplelist type="inline">
428+
<simplelist type="inline">
430429
<member><xref linkend="sql-delete"/></member>
431430
</simplelist>
432431
</refsect1>
433-
</refentry>
432+
</refentry>

postgresql/doc/src/sgml/ref/vacuum.sgml

Lines changed: 120 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
5151
ANALYZE [ <replaceable class="parameter">boolean</replaceable> ]
5252
DISABLE_PAGE_SKIPPING [ <replaceable class="parameter">boolean</replaceable> ]
5353
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> ]
5556
TRUNCATE [ <replaceable class="parameter">boolean</replaceable> ]
5657
PARALLEL <replaceable class="parameter">integer</replaceable>
5758

@@ -72,7 +73,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
7273
ANALYZE [ <replaceable class="parameter">boolean</replaceable> ]
7374
DISABLE_PAGE_SKIPPING [ <replaceable class="parameter">boolean</replaceable> ]
7475
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> ]
7678
TRUNCATE [ <replaceable class="parameter">boolean</replaceable> ]
7779
PARALLEL <replaceable class="parameter">integer</replaceable>
7880

@@ -141,12 +143,18 @@ ____________________________________________________________________________-->
141143
specify parallel workers as zero. <command>VACUUM FULL</command> rewrites
142144
the entire contents of the table into a new disk file with no extra space,
143145
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.
146148
</para>
147149
____________________________________________________________________________-->
148150
<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> 锁。
150158
</para>
151159

152160
<!--==========================orignal english content==========================
@@ -322,28 +330,97 @@ ____________________________________________________________________________-->
322330
<listitem>
323331
<!--==========================orignal english content==========================
324332
<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
338414
<literal>FULL</literal> option is used.
339415
</para>
340416
____________________________________________________________________________-->
341417
<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.
347424
</para>
348425
</listitem>
349426
</varlistentry>
@@ -391,7 +468,7 @@ ____________________________________________________________________________-->
391468
to perform the operation is equal to the number of indexes on the
392469
relation that support parallel vacuum which is limited by the number of
393470
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"/>.
395472
An index can participate in parallel vacuum if and only if the size of the
396473
index is more than <xref linkend="guc-min-parallel-index-scan-size"/>.
397474
Please note that it is not guaranteed that the number of parallel workers
@@ -409,7 +486,7 @@ ____________________________________________________________________________-->
409486
使用<replaceable class="parameter">integer</replaceable>后台处理器并行执行<command>VACUUM</command>
410487
的索引真空和索引清理阶段(每个真空阶段的详细信息请参考<xref linkend="vacuum-phases"/>))。
411488
用于执行操作的处理器数量等于关系上支持并行清理的索引数量,该数量受<literal>PARALLEL</literal>
412-
选项指定的工人数量的限制,如果有的话,该数量还受到<xref linkend="guc-max-parallel-workers-maintenance"/>限制。
489+
选项指定的工人数量的限制,如果有的话,该数量还受到<xref linkend="guc-max-parallel-maintenance-workers"/>限制。
413490
当且仅当索引的大小大于<xref linkend="guc-min-parallel-index-scan-size"/>时,索引才能参与并行清理。
414491
请注意,不保证在执行期间会使用<replaceable class="parameter">integer</replaceable>中指定的并行工作线程数。
415492
清理运行时可能需要比指定的更少的处理器,甚至根本没有处理器。每个索引只能使用一名处理器。
@@ -627,6 +704,22 @@ ____________________________________________________________________________-->
627704
<para>
628705
<productname>PostgreSQL</productname>包括了一个<quote>autovacuum</quote>工具,它可以自动进行例行的清理维护。关于自动和手动清理的更多信息请见<xref linkend="routine-vacuuming"/>。
629706
</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>
630723
</refsect1>
631724

632725
<refsect1>
@@ -678,6 +771,8 @@ ____________________________________________________________________________-->
678771
<member><xref linkend="app-vacuumdb"/></member>
679772
<member><xref linkend="runtime-config-resource-vacuum-cost"/></member>
680773
<member><xref linkend="autovacuum"/></member>
774+
<member><xref linkend="vacuum-progress-reporting"/></member>
775+
<member><xref linkend="cluster-progress-reporting"/></member>
681776
</simplelist>
682777
</refsect1>
683778
</refentry>

0 commit comments

Comments
 (0)