From 72a6406329c86df60ec0025292e03c8b2712a92d Mon Sep 17 00:00:00 2001 From: Sai Pranav Date: Sat, 21 Nov 2026 06:23:54 +0000 Subject: [PATCH v3 2/2] 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 Author: Raja Sai Pranav Reviewed-by: Fujii Masao 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 [ ( option [, ...] ) ] 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, REPACK always uses an index scan. + statistical information. Setting + to off forces a sequential scan and sort, regardless + of and . + Otherwise, setting either enable_sort or + enable_seqscan to off favors an + index scan, provided the index is usable. + + + + When clustering on an index of an access method other than B-Tree, + REPACK always uses an index scan. @@ -292,7 +301,9 @@ REPACK [ ( option [, ...] ) ] 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 to off; or + setting to off + (subject to the conditions described in + ); or omitting USING INDEX if the table doesn't need to be reordered. -- 2.56.0