table of contents
CLUSTERDB(1) | PostgreSQL 12.22 Documentation | CLUSTERDB(1) |
NAME¶
clusterdb - cluster a PostgreSQL database
SYNOPSIS¶
clusterdb [connection-option...] [--verbose | -v] [ --table | -t table ]... [dbname]
clusterdb [connection-option...] [--verbose | -v] --all | -a
DESCRIPTION¶
clusterdb is a utility for reclustering tables in a PostgreSQL database. It finds tables that have previously been clustered, 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(7). There is no effective difference between clustering databases via this utility and via other methods for accessing the server.
OPTIONS¶
clusterdb accepts the following command-line arguments:
-a
--all
[-d] dbname
[--dbname=]dbname
-e
--echo
-q
--quiet
-t table
--table=table
-v
--verbose
-V
--version
-?
--help
clusterdb also accepts the following command-line arguments for connection parameters:
-h host
--host=host
-p port
--port=port
-U username
--username=username
-w
--no-password
-W
--password
This option is never essential, since clusterdb will automatically prompt for a password if the server demands password authentication. However, clusterdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.
--maintenance-db=dbname
ENVIRONMENT¶
PGDATABASE
PGHOST
PGPORT
PGUSER
PG_COLOR
This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 33.14).
DIAGNOSTICS¶
In case of difficulty, see CLUSTER(7) and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply.
EXAMPLES¶
To cluster the database test:
$ clusterdb test
To cluster a single table foo in a database named xyzzy:
$ clusterdb --table=foo xyzzy
SEE ALSO¶
2024 | PostgreSQL 12.22 |