1VACUUMDB(1)             PostgreSQL 9.2.24 Documentation            VACUUMDB(1)
2
3
4

NAME

6       vacuumdb - garbage-collect and analyze a PostgreSQL database
7

SYNOPSIS

9       vacuumdb [connection-option...] [option...]
10                [--table | -t table [( column [,...] )]] [dbname]
11
12       vacuumdb [connection-option...] [option...] --all | -a
13

DESCRIPTION

15       vacuumdb is a utility for cleaning a PostgreSQL database.  vacuumdb
16       will also generate internal statistics used by the PostgreSQL query
17       optimizer.
18
19       vacuumdb is a wrapper around the SQL command VACUUM(7). There is no
20       effective difference between vacuuming and analyzing databases via this
21       utility and via other methods for accessing the server.
22

OPTIONS

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

ENVIRONMENT

109       PGDATABASE, PGHOST, PGPORT, PGUSER
110           Default connection parameters
111
112       This utility, like most other PostgreSQL utilities, also uses the
113       environment variables supported by libpq (see Section 31.14,
114       “Environment Variables”, in the documentation).
115

DIAGNOSTICS

117       In case of difficulty, see VACUUM(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

NOTES

123       vacuumdb might need to connect several times to the PostgreSQL server,
124       asking for a password each time. It is convenient to have a ~/.pgpass
125       file in such cases. See Section 31.15, “The Password File”, in the
126       documentation for more information.
127

EXAMPLES

129       To clean the database test:
130
131           $ vacuumdb test
132
133       To clean and analyze for the optimizer a database named bigdb:
134
135           $ vacuumdb --analyze bigdb
136
137       To clean a single table foo in a database named xyzzy, and analyze a
138       single column bar of the table for the optimizer:
139
140           $ vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
141

SEE ALSO

143       VACUUM(7)
144
145
146
147PostgreSQL 9.2.24                 2017-11-06                       VACUUMDB(1)
Impressum