Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8bc717c

Browse files
committed
New version attached. The following is implemented:
- CLUSTER ALL clusters all the tables that have some index with indisclustered set and the calling user owns.- CLUSTER tablename clusters the named table, using the index with indisclustered set. If no index has the bit set, throws elog(ERROR).- The multi-relation version (CLUSTER ALL) uses a multitransaction approach, similar to what VACUUM does.Alvaro Herrera
1 parent5b7eb4d commit8bc717c

File tree

8 files changed

+484
-38
lines changed

8 files changed

+484
-38
lines changed

‎doc/src/sgml/ref/cluster.sgml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.20 2002/09/21 18:32:54 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.21 2002/11/15 03:09:35 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -22,6 +22,8 @@ PostgreSQL documentation
2222
</refsynopsisdivinfo>
2323
<synopsis>
2424
CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">tablename</replaceable>
25+
CLUSTER <replaceable class="PARAMETER">tablename</replaceable>
26+
CLUSTER ALL
2527
</synopsis>
2628

2729
<refsect2 id="R2-SQL-CLUSTER-1">
@@ -104,6 +106,20 @@ CLUSTER
104106
periodically re-cluster by issuing the command again.
105107
</para>
106108

109+
<para>
110+
When a table is clustered, <productname>PostgreSQL</productname>
111+
remembers on which index it was clustered. In calls to
112+
<command>CLUSTER <replaceable class="parameter">tablename</replaceable></command>,
113+
the table is clustered on the same index that it was clustered before.
114+
</para>
115+
116+
<para>
117+
In calls to <command>CLUSTER ALL</command>, all the tables in the database
118+
that the calling user owns are clustered using the saved information. This
119+
form of <command>CLUSTER</command> cannot be called from inside a
120+
transaction or function.
121+
</para>
122+
107123
<refsect2 id="R2-SQL-CLUSTER-3">
108124
<refsect2info>
109125
<date>1998-09-08</date>
@@ -141,8 +157,15 @@ CLUSTER
141157
</para>
142158

143159
<para>
144-
CLUSTER preserves GRANT, inheritance, index, foreign key, and other
145-
ancillary information about the table.
160+
<command>CLUSTER</command> preserves GRANT, inheritance, index, foreign
161+
key, and other ancillary information about the table.
162+
</para>
163+
164+
<para>
165+
Because <command>CLUSTER</command> remembers the clustering information,
166+
one can cluster the tables one wants clustered manually the first time, and
167+
setup a timed event similar to <command>VACUUM</command> so that the tables
168+
are periodically and automatically clustered.
146169
</para>
147170

148171
<para>
@@ -192,6 +215,18 @@ SELECT <replaceable class="parameter">columnlist</replaceable> INTO TABLE <repla
192215
<programlisting>
193216
CLUSTER emp_ind ON emp;
194217
</programlisting>
218+
<para>
219+
Cluster the employees relation using the same index that was used before:
220+
</para>
221+
<programlisting>
222+
CLUSTER emp;
223+
</programlisting>
224+
<para>
225+
Cluster all the tables on the database that have previously been clustered:
226+
</para>
227+
<programlisting>
228+
CLUSTER ALL;
229+
</programlisting>
195230
</refsect1>
196231

197232
<refsect1 id="R1-SQL-CLUSTER-3">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp