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 ] ] [ --table | -t ta‐
12 ble
13 [ ( column [,...] ) ]
14 ] [ dbname ]
15
16 vacuumdb [ connection-options... ] [ [ --all ] [ -a ] ] [ [
17 --full ] [ -f ] ] [ [ --verbose ] [ -v ] ] [ [ --analyze ] [
18 -z ] ]
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 a response.
58
59 -t table [ (column [,...]) ]
60
61 --table table [ (column [,...]) ]
62 Clean or analyze table only. Column names may 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 vacuumdb also accepts the following command-line arguments for connec‐
80 tion parameters:
81
82 -h host
83
84 --host host
85 Specifies the host name of the machine on which the server is
86 running. If the value begins with a slash, it is used as the
87 directory for the Unix domain socket.
88
89 -p port
90
91 --port port
92 Specifies the TCP port or local Unix domain socket file exten‐
93 sion on which the server is listening for connections.
94
95 -U username
96
97 --username username
98 User name to connect as
99
100 -W
101
102 --password
103 Force password prompt.
104
106 PGDATABASE
107
108 PGHOST
109
110 PGPORT
111
112 PGUSER Default connection parameters
113
114 This utility, like most other PostgreSQL utilities, also uses the envi‐
115 ronment variables supported by libpq (see in the documentation).
116
118 In case of difficulty, see VACUUM [vacuum(7)] and psql(1) for discus‐
119 sions of potential problems and error messages. The database server
120 must be running at the targeted host. Also, any default connection set‐
121 tings and environment variables used by the libpq front-end library
122 will apply.
123
125 vacuumdb might need to connect several times to the PostgreSQL server,
126 asking for a password each time. It is convenient to have a ~/.pgpass
127 file in such cases. See in the documentation for more information.
128
130 To clean the database test:
131
132 $ vacuumdb test
133
134
135 To clean and analyze for the optimizer a database named bigdb:
136
137 $ vacuumdb --analyze bigdb
138
139
140 To clean a single table foo in a database named xyzzy, and analyze a
141 single column bar of the table for the optimizer:
142
143 $ vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
144
145
147 VACUUM [vacuum(7)]
148
149
150
151Application 2008-06-08 VACUUMDB(1)