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