4 clusterdb — cluster a PostgreSQL database
8 clusterdb [connection-option...] [option...] [ --table | -t table ] ...
9 [ dbname | -a | --all ]
13 clusterdb is a utility for reclustering tables in a PostgreSQL
14 database. It finds tables that have previously been clustered, and
15 clusters them again on the same index that was last used. Tables that
16 have never been clustered are not affected.
18 clusterdb is a wrapper around the SQL command CLUSTER. There is no
19 effective difference between clustering databases via this utility and
20 via other methods for accessing the server.
24 clusterdb accepts the following command-line arguments:
28 Cluster all databases.
32 Specifies the name of the database to be clustered, when
33 -a/--all is not used. If this is not specified, the database
34 name is read from the environment variable PGDATABASE. If that
35 is not set, the user name specified for the connection is used.
36 The dbname can be a connection string. If so, connection string
37 parameters will override any conflicting command line options.
41 Echo the commands that clusterdb generates and sends to the
46 Do not display progress messages.
50 Cluster table only. Multiple tables can be clustered by writing
55 Print detailed information during processing.
59 Print the clusterdb version and exit.
63 Show help about clusterdb command line arguments, and exit.
65 clusterdb also accepts the following command-line arguments for
66 connection parameters:
70 Specifies the host name of the machine on which the server is
71 running. If the value begins with a slash, it is used as the
72 directory for the Unix domain socket.
76 Specifies the TCP port or local Unix domain socket file
77 extension on which the server is listening for connections.
81 User name to connect as.
85 Never issue a password prompt. If the server requires password
86 authentication and a password is not available by other means
87 such as a .pgpass file, the connection attempt will fail. This
88 option can be useful in batch jobs and scripts where no user is
89 present to enter a password.
93 Force clusterdb to prompt for a password before connecting to a
96 This option is never essential, since clusterdb will
97 automatically prompt for a password if the server demands
98 password authentication. However, clusterdb will waste a
99 connection attempt finding out that the server wants a password.
100 In some cases it is worth typing -W to avoid the extra
103 --maintenance-db=dbname
104 When the -a/--all is used, connect to this database to gather
105 the list of databases to cluster. If not specified, the postgres
106 database will be used, or if that does not exist, template1 will
107 be used. This can be a connection string. If so, connection
108 string parameters will override any conflicting command line
109 options. Also, connection string parameters other than the
110 database name itself will be re-used when connecting to other
119 Default connection parameters
122 Specifies whether to use color in diagnostic messages. Possible
123 values are always, auto and never.
125 This utility, like most other PostgreSQL utilities, also uses the
126 environment variables supported by libpq (see Section 32.15).
130 In case of difficulty, see CLUSTER and psql for discussions of
131 potential problems and error messages. The database server must be
132 running at the targeted host. Also, any default connection settings and
133 environment variables used by the libpq front-end library will apply.
137 To cluster the database test:
140 To cluster a single table foo in a database named xyzzy:
141 $ clusterdb --table=foo xyzzy