win -:|:- koi -:|:- iso -:|:- dos -:|:- mac

Start -:|:- Проекты -:|:- О нас



vacuumdb  --  Clean and analyze a Postgres database


vacuumdb [ --analyze | -z ] [ --verbose | -v ] [ dbname ]
vacuumdb [ -h host ] [ -p
   port ]
    [ --table 'table [ (
   column [,...] ) ]' ]
    [ dbname ]


vacuumdb accepts the following command line arguments:


Specifies the name of the database to be cleaned or analyzed. dbname defaults to the value of the USER environment variable.

--analyze, -z

Calculate statistics on the database for use by the optimizer.

--verbose, -v

Print detailed information during processing.

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

Clean or analyze table only. Column names may be specified only in conjunction with the --analyze option.

vacuumdb also accepts the following command line arguments for connection parameters:

-h host

Specifies the hostname of the machine on which the postmaster is running. Defaults to using a local Unix domain socket rather than an IP connection..

-p port

Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the postmaster is listening for connections. The port number defaults to 5432, or the value of the PGPORT environment variable (if set).


Use password authentication. Prompts for username and password.


vacuumdb executes a VACUUM command on the specified database, so has not explicit external output.

ERROR: Can't vacuum columns, only tables. You can 'vacuum analyze' columns. vacuumdb: database vacuum failed on dbname.

The non-analyze mode requires cleaning full tables or databases. Individual columns may be specified only when analyzing a specific table.

Connection to database 'template1' failed. connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port 'port'?

vacuumdb could not attach to the postmaster process on the specified host and port. If you see this message, ensure that the postmaster is running on the proper host and that you have specified the proper port. If your site uses an authentication system, ensure that you have obtained the required authentication credentials.

Connection to database 'dbname' failed. FATAL 1: SetUserId: user 'username' is not in 'pg_shadow'

You do not have a valid entry in the relation pg_shadow and and will not be allowed to access Postgres. Contact your Postgres administrator.

Note: vacuumdb internally executes a VACUUM SQL statement. If you have problems running vacuumdb, make sure you are able to run VACUUM on the database using, for example, psql.


vacuumdb is a utility for cleaning a Postgres database. vacuumdb will also generate internal statistics used by the Postgres query optimizer.


See VACUUM for more details.


To clean a database of the same name as the user:

    % vacuumdb

To analyze a database named bigdb for the optimizer:

    % vacuumdb --analyze bigdb

To analyze a single column bar in table foo in a database named xyzzy for the optimizer:

    % vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy