1CLUSTERDB(1) PostgreSQL 9.2.24 Documentation CLUSTERDB(1)
2
3
4
6 clusterdb - cluster a PostgreSQL database
7
9 clusterdb [connection-option...] [--verbose | -v] [--table | -t table]
10 [dbname]
11
12 clusterdb [connection-option...] [--verbose | -v] --all | -a
13
15 clusterdb is a utility for reclustering tables in a PostgreSQL
16 database. It finds tables that have previously been clustered, and
17 clusters them again on the same index that was last used. Tables that
18 have never been clustered are not affected.
19
20 clusterdb is a wrapper around the SQL command CLUSTER(7). There is no
21 effective difference between clustering databases via this utility and
22 via other methods for accessing the server.
23
25 clusterdb accepts the following command-line arguments:
26
27 -a, --all
28 Cluster all databases.
29
30 [-d] dbname, [--dbname=]dbname
31 Specifies the name of the database to be clustered. If this is not
32 specified and -a (or --all) is not used, the database name is read
33 from the environment variable PGDATABASE. If that is not set, the
34 user name specified for the connection is used.
35
36 -e, --echo
37 Echo the commands that clusterdb generates and sends to the server.
38
39 -q, --quiet
40 Do not display progress messages.
41
42 -t table, --table=table
43 Cluster table only.
44
45 -v, --verbose
46 Print detailed information during processing.
47
48 -V, --version
49 Print the clusterdb version and exit.
50
51 -?, --help
52 Show help about clusterdb command line arguments, and exit.
53
54 clusterdb also accepts the following command-line arguments for
55 connection parameters:
56
57 -h host, --host=host
58 Specifies the host name of the machine on which the server is
59 running. If the value begins with a slash, it is used as the
60 directory for the Unix domain socket.
61
62 -p port, --port=port
63 Specifies the TCP port or local Unix domain socket file extension
64 on which the server is listening for connections.
65
66 -U username, --username=username
67 User name to connect as.
68
69 -w, --no-password
70 Never issue a password prompt. If the server requires password
71 authentication and a password is not available by other means such
72 as a .pgpass file, the connection attempt will fail. This option
73 can be useful in batch jobs and scripts where no user is present to
74 enter a password.
75
76 -W, --password
77 Force clusterdb to prompt for a password before connecting to a
78 database.
79
80 This option is never essential, since clusterdb will automatically
81 prompt for a password if the server demands password
82 authentication. However, clusterdb will waste a connection attempt
83 finding out that the server wants a password. In some cases it is
84 worth typing -W to avoid the extra connection attempt.
85
86 --maintenance-db=dbname
87 Specifies the name of the database to connect to discover what
88 other databases should be clustered. If not specified, the postgres
89 database will be used, and if that does not exist, template1 will
90 be used.
91
93 PGDATABASE, PGHOST, PGPORT, PGUSER
94 Default connection parameters
95
96 This utility, like most other PostgreSQL utilities, also uses the
97 environment variables supported by libpq (see Section 31.14,
98 “Environment Variables”, in the documentation).
99
101 In case of difficulty, see CLUSTER(7) and psql(1) for discussions of
102 potential problems and error messages. The database server must be
103 running at the targeted host. Also, any default connection settings and
104 environment variables used by the libpq front-end library will apply.
105
107 To cluster the database test:
108
109 $ clusterdb test
110
111 To cluster a single table foo in a database named xyzzy:
112
113 $ clusterdb --table foo xyzzy
114
116 CLUSTER(7)
117
118
119
120PostgreSQL 9.2.24 2017-11-06 CLUSTERDB(1)