1VACUUMDB(1) PostgreSQL Client Applications VACUUMDB(1)
2
3
4
6 vacuumdb - garbage-collect and analyze a PostgreSQL database
7
8
10 vacuumdb [ connection-option... ] [ --full | -f ] [ --verbose | -v ]
11 [ --analyze | -z ] [ --freeze | -F ] [ --table | -t table
12 [ ( column [,...] ) ]
13 ] [ dbname ]
14
15 vacuumdb [ connection-options... ] [ --all | -a ] [ --full | -f ] [
16 --verbose | -v ] [ --analyze | -z ] [ --freeze | -F ]
17
19 vacuumdb is a utility for cleaning a PostgreSQL database. vacuumdb
20 will also generate internal statistics used by the PostgreSQL query
21 optimizer.
22
23 vacuumdb is a wrapper around the SQL command VACUUM [vacuum(7)]. There
24 is no effective difference between vacuuming databases via this utility
25 and via other methods for accessing the server.
26
28 vacuumdb accepts the following command-line arguments:
29
30 -a
31
32 --all Vacuum all databases.
33
34 [-d] dbname
35
36 [--dbname] dbname
37 Specifies the name of the database to be cleaned or analyzed.
38 If this is not specified and -a (or --all) is not used, the
39 database name is read from the environment variable PGDATABASE.
40 If that is not set, the user name specified for the connection
41 is used.
42
43 -e
44
45 --echo Echo the commands that vacuumdb generates and sends to the
46 server.
47
48 -f
49
50 --full Perform ``full'' vacuuming.
51
52 -q
53
54 --quiet
55 Do not display progress messages.
56
57 -t table [ (column [,...]) ]
58
59 --table table [ (column [,...]) ]
60 Clean or analyze table only. Column names can be specified only
61 in conjunction with the --analyze option.
62
63 Tip: If you specify columns, you probably have to escape the
64 parentheses from the shell. (See examples below.)
65
66
67 -v
68
69 --verbose
70 Print detailed information during processing.
71
72 -z
73
74 --analyze
75 Calculate statistics for use by the optimizer.
76
77 -F
78
79 --freeze
80 Aggressively ``freeze'' tuples.
81
82 vacuumdb also accepts the following command-line arguments for connec‐
83 tion parameters:
84
85 -h host
86
87 --host host
88 Specifies the host name of the machine on which the server is
89 running. If the value begins with a slash, it is used as the
90 directory for the Unix domain socket.
91
92 -p port
93
94 --port port
95 Specifies the TCP port or local Unix domain socket file exten‐
96 sion on which the server is listening for connections.
97
98 -U username
99
100 --username username
101 User name to connect as.
102
103 -w
104
105 --no-password
106 Never issue a password prompt. If the server requires password
107 authentication and a password is not available by other means
108 such as a .pgpass file, the connection attempt will fail. This
109 option can be useful in batch jobs and scripts where no user is
110 present to enter a password.
111
112 -W
113
114 --password
115 Force vacuumdb to prompt for a password before connecting to a
116 database.
117
118 This option is never essential, since vacuumdb will automati‐
119 cally prompt for a password if the server demands password
120 authentication. However, vacuumdb will waste a connection
121 attempt finding out that the server wants a password. In some
122 cases it is worth typing -W to avoid the extra connection
123 attempt.
124
126 PGDATABASE
127
128 PGHOST
129
130 PGPORT
131
132 PGUSER Default connection parameters
133
134 This utility, like most other PostgreSQL utilities, also uses the envi‐
135 ronment variables supported by libpq (see in the documentation).
136
138 In case of difficulty, see VACUUM [vacuum(7)] and psql(1) for discus‐
139 sions of potential problems and error messages. The database server
140 must be running at the targeted host. Also, any default connection set‐
141 tings and environment variables used by the libpq front-end library
142 will apply.
143
145 vacuumdb might need to connect several times to the PostgreSQL server,
146 asking for a password each time. It is convenient to have a ~/.pgpass
147 file in such cases. See in the documentation for more information.
148
150 To clean the database test:
151
152 $ vacuumdb test
153
154
155 To clean and analyze for the optimizer a database named bigdb:
156
157 $ vacuumdb --analyze bigdb
158
159
160 To clean a single table foo in a database named xyzzy, and analyze a
161 single column bar of the table for the optimizer:
162
163 $ vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
164
165
167 VACUUM [vacuum(7)]
168
169
170
171Application 2011-09-22 VACUUMDB(1)