Reclusters tables that were previously clustered with
clusterdb [<connection-option> ...] [--verbose | -v] [--table | -t <table>] [[--dbname | -d] <dbname] clusterdb [<connection-option> ...] [--all | -a] [--verbose | -v] clusterdb -? | --help clusterdb -V | --version
To cluster a table means to physically reorder a table on disk according to an index so that index scan operations can access data on disk in a somewhat sequential order, thereby improving index seek performance for queries that use that index.
clusterdb utility will find any tables in a database that have previously been clustered with the
CLUSTER SQL command, and clusters them again on the same index that was last used. Tables that have never been clustered are not affected.
clusterdb is a wrapper around the SQL command
CLUSTER. Although clustering a table in this way is supported in Greenplum Database, it is not recommended because the
CLUSTER operation itself is extremely slow.
If you do need to order a table in this way to improve your query performance, use a
CREATE TABLE AS statement to reorder the table on disk rather than using
CLUSTER. If you do 'cluster' a table in this way, then
clusterdb would not be relevant.
PGDATABASE. If that is not set, the user name specified for the connection is used.
clusterdbgenerates and sends to the server.
clusterdbversion and exit.
clusterdbcommand line arguments, and exit.
PGHOSTor defaults to localhost.
PGPORTor defaults to 5432.
PGUSERor defaults to the current system role name.
.pgpassfile, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.
postgresdatabase will be used, and if that does not exist,
template1will be used.
To cluster the database
To cluster a single table
foo in a database named
clusterdb --table foo xyzzyb