vacuumdb

Name

vacuumdb  --  Cleans and analyzes a database.

Synopsis

vacuumdb [ options ] [ --analyze | -z ]
    [ --alldb | -a ] [ --verbose | -v ]
    [ --table 'table [ ( column [,...] ) ]' ] [ [-d] dbname ]
  

Parameters

The vacuumdb program accepts the following command line arguments:

-d dbname, --dbname dbname

Use this parameter to specify the name of the database you wish to clean or analyze.

-z, --analyze

Pass this parameter to calculate the database's statistics so they can be used by the optimizer.

-a, --alldb

Pass this parameter to vacuum all databases.

-v, --verbose

Pass this parameter to have more detailed information displayed while vacuuming is in progress.

-t table [ (column [,...]) ], --table table [ (column [,...]) ]

Use this parameter to perform a vacuum only on a specified table. You may only pass column names while using the --analyze option. You will most likely have to escape paranthesis from the command line when doing so.

-h host, --host host

Use this parameter to specify the hostname that postmaster is running on.

-p port, --port port

Use this parameter to specify either the TCP/IP port or socket file extension that postmaster is running on.

-U username, --username username

This parameter takes the username you wish to connect as.

-W, --password

Pass this parameter to force vacuumdb to prompt for a password during operation.

-e, --echo

Pass this parameter to display all commands that vacuumdb generates and sends to the backend.

-q, --quiet

Pass this parameter to run in quiet mode; while in quiet mode, the program will not display any information.

Results

VACUUM

This message is displayed if the vacuuming process was successful.

vacuumdb: Vacuum failed.

This message is displayed if an error was encountered during the vacuum. Any error messages displayed will be the same as would be generated by the actual VACUUM command; refer to VACUUM for more information on error messages displayed.

Description

Use vacuumdb to clean up a database or display quer optimizer statistics about it. Essentially, the command is a wrapper for the VACUUM command. Because it is a script, it is executable from the command line (whereas the normal VACUUM command requires you to be connected to the database through a frontend application). Also, because the script executes the psql program in order to run its command, you may receive psql error messages; the psql reference section contains more information about its program-specific errors.

Examples

The following example will clean up the booktown database.

$ vacuumdb booktown