postgres.git / summary / log / commit / refs
commit f5ead259821bb5a10d07c0e9b4f7016706d787ee
Author: Fujii Masao <fujii@postgresql.org>
Date: Tue Nov 24 02:30:15 2026 +0000
doc: Clarify scan method selection for REPACK and CLUSTER
The documentation described using enable_sort to avoid sorting during
clustering, but did not explain how enable_indexscan and enable_seqscan
affected that choice. This left the conditions for avoiding sorting
unclear.
Document these settings together with the scan method selection rules
for B-tree indexes. Explain that enable_indexscan = off forces a
sequential scan and sort regardless of the other two settings.
Otherwise, disabling enable_sort or enable_seqscan favors an index
scan, provided the index is usable.
Suggested-by: Fujii Masao <masao.fujii@gmail.com>
Author: Raja Sai Pranav <rajasaipranav0@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGhA-tzFGPV+oBQF1jK==tSkmwM=z_z9p+bhb-yYCAzLA@mail.gmail.com
doc/src/sgml/ref/repack.sgml | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/ref/repack.sgml b/doc/src/sgml/ref/repack.sgml
index 4cd3cfa0b11..0649e033aa1 100644
--- a/doc/src/sgml/ref/repack.sgml
+++ b/doc/src/sgml/ref/repack.sgml
@@ -258,8 +258,17 @@ REPACK [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] USING
the table using either an index scan on the specified index, or a
sequential scan followed by sorting. It will attempt to choose the method
that will be faster, based on planner cost parameters and available
- statistical information. When clustering on an index of an access method
- other than B-Tree, <command>REPACK</command> always uses an index scan.
+ statistical information. Setting <xref linkend="guc-enable-indexscan"/>
+ to <literal>off</literal> forces a sequential scan and sort, regardless
+ of <xref linkend="guc-enable-sort"/> and <xref linkend="guc-enable-seqscan"/>.
+ Otherwise, setting either <varname>enable_sort</varname> or
+ <varname>enable_seqscan</varname> to <literal>off</literal> favors an
+ index scan, provided the index is usable.
+ </para>
+
+ <para>
+ When clustering on an index of an access method other than B-Tree,
+ <command>REPACK</command> always uses an index scan.
</para>
<para>
@@ -292,7 +301,9 @@ REPACK [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] USING
file of up to the size of the table is needed in addition to the above.
This method is usually faster than an index scan, but if the disk space
requirement is intolerable, you can disable this choice by temporarily
- setting <xref linkend="guc-enable-sort"/> to <literal>off</literal>; or
+ setting <xref linkend="guc-enable-sort"/> to <literal>off</literal>
+ (subject to the conditions described in
+ <xref linkend="sql-repack-notes-on-clustering"/>); or
omitting <literal>USING INDEX</literal> if the table doesn't need to be
reordered.
</para>
[parent: 927939e924a0]