]> begriffs open source - ai-pg/blob - full-docs/txt/app-clusterdb.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / app-clusterdb.txt
1
2 clusterdb
3
4    clusterdb — cluster a PostgreSQL database
5
6 Synopsis
7
8    clusterdb [connection-option...] [option...] [ --table | -t table ] ...
9    [ dbname | -a | --all ]
10
11 Description
12
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.
17
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.
21
22 Options
23
24    clusterdb accepts the following command-line arguments:
25
26    -a
27           --all
28           Cluster all databases.
29
30    [-d] dbname
31           [--dbname=]dbname
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.
38
39    -e
40           --echo
41           Echo the commands that clusterdb generates and sends to the
42           server.
43
44    -q
45           --quiet
46           Do not display progress messages.
47
48    -t table
49           --table=table
50           Cluster table only. Multiple tables can be clustered by writing
51           multiple -t switches.
52
53    -v
54           --verbose
55           Print detailed information during processing.
56
57    -V
58           --version
59           Print the clusterdb version and exit.
60
61    -?
62           --help
63           Show help about clusterdb command line arguments, and exit.
64
65    clusterdb also accepts the following command-line arguments for
66    connection parameters:
67
68    -h host
69           --host=host
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.
73
74    -p port
75           --port=port
76           Specifies the TCP port or local Unix domain socket file
77           extension on which the server is listening for connections.
78
79    -U username
80           --username=username
81           User name to connect as.
82
83    -w
84           --no-password
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.
90
91    -W
92           --password
93           Force clusterdb to prompt for a password before connecting to a
94           database.
95
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
101           connection attempt.
102
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
111           databases.
112
113 Environment
114
115    PGDATABASE
116           PGHOST
117           PGPORT
118           PGUSER
119           Default connection parameters
120
121    PG_COLOR
122           Specifies whether to use color in diagnostic messages. Possible
123           values are always, auto and never.
124
125    This utility, like most other PostgreSQL utilities, also uses the
126    environment variables supported by libpq (see Section 32.15).
127
128 Diagnostics
129
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.
134
135 Examples
136
137    To cluster the database test:
138 $ clusterdb test
139
140    To cluster a single table foo in a database named xyzzy:
141 $ clusterdb --table=foo xyzzy
142
143 See Also
144
145    CLUSTER