1CLUSTERDB(1)             PostgreSQL 11.3 Documentation            CLUSTERDB(1)
2
3
4

NAME

6       clusterdb - cluster a PostgreSQL database
7

SYNOPSIS

9       clusterdb [connection-option...] [--verbose | -v]
10                 [ --table | -t table ]...  [dbname]
11
12       clusterdb [connection-option...] [--verbose | -v] --all | -a
13

DESCRIPTION

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

OPTIONS

25       clusterdb accepts the following command-line arguments:
26
27       -a
28       --all
29           Cluster all databases.
30
31       [-d] dbname
32       [--dbname=]dbname
33           Specifies the name of the database to be clustered. If this is not
34           specified and -a (or --all) is not used, the database name is read
35           from the environment variable PGDATABASE. If that is not set, the
36           user name specified for the connection is used.
37
38       -e
39       --echo
40           Echo the commands that clusterdb generates and sends to the server.
41
42       -q
43       --quiet
44           Do not display progress messages.
45
46       -t table
47       --table=table
48           Cluster table only. Multiple tables can be clustered by writing
49           multiple -t switches.
50
51       -v
52       --verbose
53           Print detailed information during processing.
54
55       -V
56       --version
57           Print the clusterdb version and exit.
58
59       -?
60       --help
61           Show help about clusterdb command line arguments, and exit.
62
63       clusterdb also accepts the following command-line arguments for
64       connection parameters:
65
66       -h host
67       --host=host
68           Specifies the host name of the machine on which the server is
69           running. If the value begins with a slash, it is used as the
70           directory for the Unix domain socket.
71
72       -p port
73       --port=port
74           Specifies the TCP port or local Unix domain socket file extension
75           on which the server is listening for connections.
76
77       -U username
78       --username=username
79           User name to connect as.
80
81       -w
82       --no-password
83           Never issue a password prompt. If the server requires password
84           authentication and a password is not available by other means such
85           as a .pgpass file, the connection attempt will fail. This option
86           can be useful in batch jobs and scripts where no user is present to
87           enter a password.
88
89       -W
90       --password
91           Force clusterdb to prompt for a password before connecting to a
92           database.
93
94           This option is never essential, since clusterdb will automatically
95           prompt for a password if the server demands password
96           authentication. However, clusterdb will waste a connection attempt
97           finding out that the server wants a password. In some cases it is
98           worth typing -W to avoid the extra connection attempt.
99
100       --maintenance-db=dbname
101           Specifies the name of the database to connect to discover what
102           other databases should be clustered. If not specified, the postgres
103           database will be used, and if that does not exist, template1 will
104           be used.
105

ENVIRONMENT

107       PGDATABASE
108       PGHOST
109       PGPORT
110       PGUSER
111           Default connection parameters
112
113       This utility, like most other PostgreSQL utilities, also uses the
114       environment variables supported by libpq (see Section 34.14).
115

DIAGNOSTICS

117       In case of difficulty, see CLUSTER(7) and psql(1) for discussions of
118       potential problems and error messages. The database server must be
119       running at the targeted host. Also, any default connection settings and
120       environment variables used by the libpq front-end library will apply.
121

EXAMPLES

123       To cluster the database test:
124
125           $ clusterdb test
126
127       To cluster a single table foo in a database named xyzzy:
128
129           $ clusterdb --table=foo xyzzy
130

SEE ALSO

132       CLUSTER(7)
133
134
135
136PostgreSQL 11.3                      2019                         CLUSTERDB(1)
Impressum