Garbage-collects and analyzes a database.
vacuumdb is typically run on system catalog tables. It has no effect when run on HAWQ user tables.
vacuumdb [<connection_options>] [<vacuum_options>] [<database_name>] vacuumdb [-? | --help] vacuumdb --version
<connection_options> = [-h <host> | --host <host>] [-p <port> | --port <port>] [-U <username> | --username <username>] [-w | --no-password] [-W | --password] <vacuum_options> = [(-a | --all) | (-d <dbname> | --dbame <dbname>)] [-e | --echo] [-f | --full] [-F | --freeze] [-t <tablename> [( column [,...] )] | --table <tablename> [( column [,...] )] ] [(-v | --verbose) | (-q | --quiet)] [-z | --analyze]
vacuumdb is a utility for cleaning a PostgreSQL database.
vacuumdb will also generate internal statistics used by the PostgreSQL query optimizer.
vacuumdb is a wrapper around the SQL command
VACUUM. There is no effective difference between vacuuming databases via this utility and via other methods for accessing the server.
-doption are not provided, the environment variable
PGDATABASEis used. If that is not set, the user name specified for the connection is used.
--allis not used, the database name is read from the environment variable
PGDATABASE. If that is not set, the user name specified for the connection is used.
VACUUM FULL is not recommended in HAWQ.
--analyzeoption. If you specify columns, you probably have to escape the parentheses from the shell.
PGHOSTor defaults to localhost.
PGPORTor defaults to 5432.
PGUSERor defaults to the current system user name.
.pgpassfile, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.
vacuumdb might need to connect several times to the master server, asking for a password each time. It is convenient to have a
~/.pgpass file for such cases.
To clean the database
$ vacuumdb testdb
To clean and analyze a database named
$ vacuumdb --analyze bigdb
To clean a single table
foo in a database named
mydb, and analyze a single column
bar of the table:
$ vacuumdb --analyze --verbose --table 'foo(bar)' mydb
Note the quotes around the table and column names to escape the parentheses from the shell.