CLUSTER

Name

CLUSTER  --  Provides the backend server with clustering information about a table.

Synopsis

CLUSTER indexname ON table
  

Parameters

indexname

Use this parameter to supply the name of an index location.

table

Use this paramter to supply the name of the table you wish to cluster.

Results

CLUSTER

This message is displayed if the cluster is successfully performed.

ERROR: relation <tablerelation_number> inherits "table"

ERROR: Relation table does not exist!

Description

Use the CLUSTER command to cluster a table with a specific index. The table (identified by the table parameter) must already exist and the index (identified by the index parameter) must exist on the table.

During clustering, a table is reordered in an arrangement based on the supplied index. A cluster is a one-time operation upon a table; to re-cluster a table, you must execute the command again.

When a cluster is created, the table is actually being copied to a temporary table according to index order, then it is renamed to the original table name. Because of this, all permissions and other indexes are lost when clustering is performed.

Examples

The following example clusters the book relation on the basis of its isbn attribute.

CLUSTER isbn ON book;