GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.postgresql.org — CLUSTER November 19, 2026: PostgreSQL 19 Released!
Development Versions:
devel
CLUSTERCLUSTER — cluster a table according to an index SynopsisCLUSTER [ ( Description
When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated rows according to their index order. (If one wishes, one can periodically recluster by issuing the command again. Also, setting the table's When a table is clustered, PostgreSQL remembers which index it was clustered by. The form
When a table is being clustered, an Parameters
NotesTo cluster a table, one must have the In cases where you are accessing single rows randomly within a table, the actual order of the data in the table is unimportant. However, if you tend to access some data more than others, and there is an index that groups them together, you will benefit from using
While When an index scan is used, a temporary copy of the table is created that contains the table data in the index order. Temporary copies of each index on the table are created as well. Therefore, you need free space on disk at least equal to the sum of the table size and the index sizes. When a sequential scan and sort is used, a temporary sort file is also created, so that the peak temporary space requirement is as much as double the table size, plus the index sizes. This method is often faster than the index scan method, but if the disk space requirement is intolerable, you can disable this choice by temporarily setting enable_sort to It is advisable to set maintenance_work_mem to a reasonably large value (but not more than the amount of RAM you can dedicate to the Because the planner records statistics about the ordering of tables, it is advisable to run Because Each backend running Clustering a partitioned table clusters each of its partitions using the partition of the specified partitioned index. When clustering a partitioned table, the index may not be omitted. ExamplesCluster the table CLUSTER employees USING employees_ind; Cluster the CLUSTER employees; Cluster all tables in the database that have previously been clustered: CLUSTER; CompatibilityThere is no The following syntax was used before PostgreSQL 17 and is still supported: CLUSTER [ VERBOSE ] [ The following syntax was used before PostgreSQL 8.3 and is still supported: CLUSTER See Alsoclusterdb, Section 27.4.2Submit correctionIf you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |