{"Entry":{"collection":"tool","key":"vacuumdb","name":"vacuumdb","aliases":["vacuumdb"],"metadata":{"aliases":["vacuumdb"],"category":"Client applications","content_hash":"26a67ce7619a36c363132545a2fcc046f53db233977a6e500674c74d5e6bcbc7","imported_at":"2026-09-30T00:40:34.769992+08:00","name":"vacuumdb","name_zh":"","slug":"vacuumdb","summary":"vacuumdb — garbage-collect and analyze a PostgreSQL database"}},"Definition":{"Collection":"tool","Key":"vacuumdb","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"vacuumdb","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"options":[{"description":"Vacuum all databases.","names":["-a","--all"],"signature":"-a --all"},{"description":"Specifies the Buffer Access Strategy ring buffer size for a given invocation of vacuumdb . This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See VACUUM .","names":["--buffer-usage-limit size"],"signature":"--buffer-usage-limit size"},{"description":"Disable skipping pages based on the contents of the visibility map.","names":["--disable-page-skipping"],"signature":"--disable-page-skipping"},{"description":"Echo the commands that vacuumdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo"},{"description":"Perform “ full ” vacuuming.","names":["-f","--full"],"signature":"-f --full"},{"description":"Aggressively “ freeze ” tuples.","names":["-F","--freeze"],"signature":"-F --freeze"},{"description":"Always remove index entries pointing to dead tuples.","names":["--force-index-cleanup"],"signature":"--force-index-cleanup"},{"description":"Execute the vacuum or analyze commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. vacuumdb will open njobs connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Note that using this mode together with the -f ( FULL ) option might cause deadlock failures if certain system catalogs are processed in parallel.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs"},{"description":"Only execute the vacuum or analyze commands on tables with a multixact ID age of at least mxid_age . This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see Section 24.1.5.1 ). For the purposes of this option, the multixact ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by vacuumdb will also process the TOAST table for the relation if necessary, it does not need to be considered separately.","names":["--min-mxid-age mxid_age"],"signature":"--min-mxid-age mxid_age"},{"description":"Only execute the vacuum or analyze commands on tables with a transaction ID age of at least xid_age . This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see Section 24.1.5 ). For the purposes of this option, the transaction ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by vacuumdb will also process the TOAST table for the relation if necessary, it does not need to be considered separately.","names":["--min-xid-age xid_age"],"signature":"--min-xid-age xid_age"},{"description":"Only analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with --analyze-in-stages , this option prevents vacuumdb from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices. This option can only be used in conjunction with --analyze-only or --analyze-in-stages . Note that --missing-stats-only requires SELECT privileges on pg_statistic and pg_statistic_ext_data , which are restricted to superusers by default.","names":["--missing-stats-only"],"signature":"--missing-stats-only"},{"description":"Clean or analyze all tables in schema only. Multiple schemas can be vacuumed by writing multiple -n switches.","names":["-n schema","--schema= schema"],"signature":"-n schema --schema= schema"},{"description":"Do not clean or analyze any tables in schema . Multiple schemas can be excluded by writing multiple -N switches.","names":["-N schema","--exclude-schema= schema"],"signature":"-N schema --exclude-schema= schema"},{"description":"Do not remove index entries pointing to dead tuples.","names":["--no-index-cleanup"],"signature":"--no-index-cleanup"},{"description":"Skip the main relation.","names":["--no-process-main"],"signature":"--no-process-main"},{"description":"Skip the TOAST table associated with the table to vacuum, if any.","names":["--no-process-toast"],"signature":"--no-process-toast"},{"description":"Do not truncate empty pages at the end of the table.","names":["--no-truncate"],"signature":"--no-truncate"},{"description":"Specify the number of parallel workers for parallel vacuum . This allows the vacuum to leverage multiple CPUs to process indexes. See VACUUM .","names":["-P parallel_workers","--parallel= parallel_workers"],"signature":"-P parallel_workers --parallel= parallel_workers"},{"description":"Do not display progress messages.","names":["-q","--quiet"],"signature":"-q --quiet"},{"description":"Skip relations that cannot be immediately locked for processing.","names":["--skip-locked"],"signature":"--skip-locked"},{"description":"Clean or analyze table only. Column names can be specified only in conjunction with the --analyze or --analyze-only options. Multiple tables can be vacuumed by writing multiple -t switches. Tip If you specify columns, you probably have to escape the parentheses from the shell. (See examples below.)","names":["-t table [ ( column [,...]) ]","--table= table [ ( column [,...]) ]"],"signature":"-t table [ ( column [,...]) ] --table= table [ ( column [,...]) ]"},{"description":"Print detailed information during processing.","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"Print the vacuumdb version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Also calculate statistics for use by the optimizer.","names":["-z","--analyze"],"signature":"-z --analyze"},{"description":"Only calculate statistics for use by the optimizer (no vacuum).","names":["-Z","--analyze-only"],"signature":"-Z --analyze-only"},{"description":"Only calculate statistics for use by the optimizer (no vacuum), like --analyze-only . Run three stages of analyze; the first stage uses the lowest possible statistics target (see default_statistics_target ) to produce usable statistics faster, and subsequent stages build the full statistics. This option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by pg_upgrade . Be aware that running with this option in a database with existing statistics may cause the query optimizer choices to become transiently worse due to the low statistics targets of the early stages.","names":["--analyze-in-stages"],"signature":"--analyze-in-stages"},{"description":"Show help about vacuumdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force vacuumdb to prompt for a password before connecting to a database. This option is never essential, since vacuumdb will automatically prompt for a password if the server demands password authentication. However, vacuumdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"When the -a / --all is used, connect to this database to gather the list of databases to vacuum. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname"}],"synopsis":["vacuumdb [ connection-option ...] [ option ...] [ -t | --table table [( column [,...] )] ] ... [ dbname | -a | --all ]","vacuumdb [ connection-option ...] [ option ...] [ -n | --schema schema ] ... [ dbname | -a | --all ]","vacuumdb [ connection-option ...] [ option ...] [ -N | --exclude-schema schema ] ... [ dbname | -a | --all ]"]},"comparison_hash":"c475ca852806a0a70db22a56bbad2d270080a07ee8d55cb7db8335b2d58e171a","description":["vacuumdb — garbage-collect and analyze a PostgreSQL database"],"environment":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"facts":[{"label":"Documented executable","value":"vacuumdb"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"33"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-VACUUMDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003evacuumdb — garbage-collect and analyze a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.1\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-t\u003c/code\u003e | \u003ccode class=\"option\"\u003e--table\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...] )] ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.2\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-n\u003c/code\u003e | \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.3\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-N\u003c/code\u003e | \u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e is a utility for cleaning a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also generate internal statistics used by the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e query optimizer.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e\u003c/a\u003e. There is no effective difference between vacuuming and analyzing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eVacuum all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--buffer-usage-limit \u003cem class=\"replaceable\"\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\" title=\"Buffer Access Strategy\"\u003eBuffer Access Strategy\u003c/a\u003e ring buffer size for a given invocation of \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e. This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e-d\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e--dbname=\u003c/span\u003e]\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be cleaned or analyzed, when \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-page-skipping\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisable skipping pages based on the contents of the visibility map.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--full\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePerform \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efull\u003c/span\u003e”\u003c/span\u003e vacuuming.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--freeze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAggressively \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efreeze\u003c/span\u003e”\u003c/span\u003e tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--force-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlways remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the vacuum or analyze commands in parallel by running \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that using this mode together with the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e (\u003ccode class=\"literal\"\u003eFULL\u003c/code\u003e) option might cause deadlock failures if certain system catalogs are processed in parallel.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--min-mxid-age \u003cem class=\"replaceable\"\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a multixact ID age of at least \u003cem class=\"replaceable\"\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-MULTIXACT-WRAPAROUND\" title=\"24.1.5.1. Multixacts and Wraparound\"\u003eSection 24.1.5.1\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the multixact ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--min-xid-age \u003cem class=\"replaceable\"\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a transaction ID age of at least \u003cem class=\"replaceable\"\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND\" title=\"24.1.5. Preventing Transaction ID Wraparound Failures\"\u003eSection 24.1.5\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the transaction ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--missing-stats-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with \u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e, this option prevents \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices.\u003c/p\u003e\n\u003cp\u003eThis option can only be used in conjunction with \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eNote that \u003ccode class=\"option\"\u003e--missing-stats-only\u003c/code\u003e requires \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e privileges on \u003ca class=\"link\" href=\"/docs/18/catalog-pg-statistic.html\" title=\"52.51. pg_statistic\"\u003e\u003ccode class=\"structname\"\u003epg_statistic\u003c/code\u003e\u003c/a\u003e and \u003ca class=\"link\" href=\"/docs/18/catalog-pg-statistic-ext-data.html\" title=\"52.53. pg_statistic_ext_data\"\u003e\u003ccode class=\"structname\"\u003epg_statistic_ext_data\u003c/code\u003e\u003c/a\u003e, which are restricted to superusers by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze all tables in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be vacuumed by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not clean or analyze any tables in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e. Multiple schemas can be excluded by writing multiple \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-process-main\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the main relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-process-toast\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the TOAST table associated with the table to vacuum, if any.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-truncate\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not truncate empty pages at the end of the table.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--parallel=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the number of parallel workers for \u003cem class=\"firstterm\"\u003eparallel vacuum\u003c/em\u003e. This allows the vacuum to leverage multiple CPUs to process indexes. See \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--skip-locked\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip relations that cannot be immediately locked for processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Column names can be specified only in conjunction with the \u003ccode class=\"option\"\u003e--analyze\u003c/code\u003e or \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e options. Multiple tables can be vacuumed by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003cdiv class=\"tip\"\u003e\n\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\n\u003cp\u003eIf you specify columns, you probably have to escape the parentheses from the shell. (See examples below.)\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlso calculate statistics for use by the optimizer.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum), like \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e. Run three stages of analyze; the first stage uses the lowest possible statistics target (see \u003ca class=\"xref\" href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\"\u003edefault_statistics_target\u003c/a\u003e) to produce usable statistics faster, and subsequent stages build the full statistics.\u003c/p\u003e\n\u003cp\u003eThis option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by \u003ccode class=\"command\"\u003epg_upgrade\u003c/code\u003e. Be aware that running with this option in a database with existing statistics may cause the query optimizer choices to become transiently worse due to the low statistics targets of the early stages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to vacuum. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo clean the database \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean and analyze for the optimizer a database named \u003ccode class=\"literal\"\u003ebigdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --analyze bigdb\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean a single table \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e in a database named \u003ccode class=\"literal\"\u003exyzzy\u003c/code\u003e, and analyze a single column \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e of the table for the optimizer:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --analyze --verbose --table='foo(bar)' xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean all tables in the \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e and \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e schemas in a database named \u003ccode class=\"literal\"\u003exyzzy\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --schema='foo' --schema='bar' xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-vacuumdb.html","options":[{"description":"Vacuum all databases.","names":["-a","--all"],"signature":"-a --all","source_url":"/docs/18/app-vacuumdb.html","summary":"Vacuum all databases."},{"description":"Specifies the Buffer Access Strategy ring buffer size for a given invocation of vacuumdb . This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See VACUUM .","names":["--buffer-usage-limit size"],"signature":"--buffer-usage-limit size","source_url":"/docs/18/app-vacuumdb.html","summary":"Specifies the Buffer Access Strategy ring buffer size for a given invocation of vacuumdb . This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See VACUUM ."},{"description":"Disable skipping pages based on the contents of the visibility map.","names":["--disable-page-skipping"],"signature":"--disable-page-skipping","source_url":"/docs/18/app-vacuumdb.html","summary":"Disable skipping pages based on the contents of the visibility map."},{"description":"Echo the commands that vacuumdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo","source_url":"/docs/18/app-vacuumdb.html","summary":"Echo the commands that vacuumdb generates and sends to the server."},{"description":"Perform “ full ” vacuuming.","names":["-f","--full"],"signature":"-f --full","source_url":"/docs/18/app-vacuumdb.html","summary":"Perform “ full ” vacuuming."},{"description":"Aggressively “ freeze ” tuples.","names":["-F","--freeze"],"signature":"-F --freeze","source_url":"/docs/18/app-vacuumdb.html","summary":"Aggressively “ freeze ” tuples."},{"description":"Always remove index entries pointing to dead tuples.","names":["--force-index-cleanup"],"signature":"--force-index-cleanup","source_url":"/docs/18/app-vacuumdb.html","summary":"Always remove index entries pointing to dead tuples."},{"description":"Execute the vacuum or analyze commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. vacuumdb will open njobs connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Note that using this mode together with the -f ( FULL ) option might cause deadlock failures if certain system catalogs are processed in parallel.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs","source_url":"/docs/18/app-vacuumdb.html","summary":"Execute the vacuum or analyze commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"description":"Only execute the vacuum or analyze commands on tables with a multixact ID age of at least mxid_age . This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see Section 24.1.5.1 ). For the purposes of this option, the multixact ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by vacuumdb will also process the TOAST table for the relation if necessary, it does not need to be considered separately.","names":["--min-mxid-age mxid_age"],"signature":"--min-mxid-age mxid_age","source_url":"/docs/18/app-vacuumdb.html","summary":"Only execute the vacuum or analyze commands on tables with a multixact ID age of at least mxid_age . This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see Section 24.1.5.1 )."},{"description":"Only execute the vacuum or analyze commands on tables with a transaction ID age of at least xid_age . This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see Section 24.1.5 ). For the purposes of this option, the transaction ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by vacuumdb will also process the TOAST table for the relation if necessary, it does not need to be considered separately.","names":["--min-xid-age xid_age"],"signature":"--min-xid-age xid_age","source_url":"/docs/18/app-vacuumdb.html","summary":"Only execute the vacuum or analyze commands on tables with a transaction ID age of at least xid_age . This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see Section 24.1.5 )."},{"description":"Only analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with --analyze-in-stages , this option prevents vacuumdb from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices. This option can only be used in conjunction with --analyze-only or --analyze-in-stages . Note that --missing-stats-only requires SELECT privileges on pg_statistic and pg_statistic_ext_data , which are restricted to superusers by default.","names":["--missing-stats-only"],"signature":"--missing-stats-only","source_url":"/docs/18/app-vacuumdb.html","summary":"Only analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with --analyze-in-stages , this option prevents vacuumdb from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices."},{"description":"Clean or analyze all tables in schema only. Multiple schemas can be vacuumed by writing multiple -n switches.","names":["-n schema","--schema= schema"],"signature":"-n schema --schema= schema","source_url":"/docs/18/app-vacuumdb.html","summary":"Clean or analyze all tables in schema only. Multiple schemas can be vacuumed by writing multiple -n switches."},{"description":"Do not clean or analyze any tables in schema . Multiple schemas can be excluded by writing multiple -N switches.","names":["-N schema","--exclude-schema= schema"],"signature":"-N schema --exclude-schema= schema","source_url":"/docs/18/app-vacuumdb.html","summary":"Do not clean or analyze any tables in schema . Multiple schemas can be excluded by writing multiple -N switches."},{"description":"Do not remove index entries pointing to dead tuples.","names":["--no-index-cleanup"],"signature":"--no-index-cleanup","source_url":"/docs/18/app-vacuumdb.html","summary":"Do not remove index entries pointing to dead tuples."},{"description":"Skip the main relation.","names":["--no-process-main"],"signature":"--no-process-main","source_url":"/docs/18/app-vacuumdb.html","summary":"Skip the main relation."},{"description":"Skip the TOAST table associated with the table to vacuum, if any.","names":["--no-process-toast"],"signature":"--no-process-toast","source_url":"/docs/18/app-vacuumdb.html","summary":"Skip the TOAST table associated with the table to vacuum, if any."},{"description":"Do not truncate empty pages at the end of the table.","names":["--no-truncate"],"signature":"--no-truncate","source_url":"/docs/18/app-vacuumdb.html","summary":"Do not truncate empty pages at the end of the table."},{"description":"Specify the number of parallel workers for parallel vacuum . This allows the vacuum to leverage multiple CPUs to process indexes. See VACUUM .","names":["-P parallel_workers","--parallel= parallel_workers"],"signature":"-P parallel_workers --parallel= parallel_workers","source_url":"/docs/18/app-vacuumdb.html","summary":"Specify the number of parallel workers for parallel vacuum . This allows the vacuum to leverage multiple CPUs to process indexes. See VACUUM ."},{"description":"Do not display progress messages.","names":["-q","--quiet"],"signature":"-q --quiet","source_url":"/docs/18/app-vacuumdb.html","summary":"Do not display progress messages."},{"description":"Skip relations that cannot be immediately locked for processing.","names":["--skip-locked"],"signature":"--skip-locked","source_url":"/docs/18/app-vacuumdb.html","summary":"Skip relations that cannot be immediately locked for processing."},{"description":"Clean or analyze table only. Column names can be specified only in conjunction with the --analyze or --analyze-only options. Multiple tables can be vacuumed by writing multiple -t switches. Tip If you specify columns, you probably have to escape the parentheses from the shell. (See examples below.)","names":["-t table [ ( column [,...]) ]","--table= table [ ( column [,...]) ]"],"signature":"-t table [ ( column [,...]) ] --table= table [ ( column [,...]) ]","source_url":"/docs/18/app-vacuumdb.html","summary":"Clean or analyze table only. Column names can be specified only in conjunction with the --analyze or --analyze-only options. Multiple tables can be vacuumed by writing multiple -t switches."},{"description":"Print detailed information during processing.","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-vacuumdb.html","summary":"Print detailed information during processing."},{"description":"Print the vacuumdb version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-vacuumdb.html","summary":"Print the vacuumdb version and exit."},{"description":"Also calculate statistics for use by the optimizer.","names":["-z","--analyze"],"signature":"-z --analyze","source_url":"/docs/18/app-vacuumdb.html","summary":"Also calculate statistics for use by the optimizer."},{"description":"Only calculate statistics for use by the optimizer (no vacuum).","names":["-Z","--analyze-only"],"signature":"-Z --analyze-only","source_url":"/docs/18/app-vacuumdb.html","summary":"Only calculate statistics for use by the optimizer (no vacuum)."},{"description":"Only calculate statistics for use by the optimizer (no vacuum), like --analyze-only . Run three stages of analyze; the first stage uses the lowest possible statistics target (see default_statistics_target ) to produce usable statistics faster, and subsequent stages build the full statistics. This option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by pg_upgrade . Be aware that running with this option in a database with existing statistics may cause the query optimizer choices to become transiently worse due to the low statistics targets of the early stages.","names":["--analyze-in-stages"],"signature":"--analyze-in-stages","source_url":"/docs/18/app-vacuumdb.html","summary":"Only calculate statistics for use by the optimizer (no vacuum), like --analyze-only . Run three stages of analyze; the first stage uses the lowest possible statistics target (see default_statistics_target ) to produce usable statistics faster, and subsequent stages build the full statistics."},{"description":"Show help about vacuumdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-vacuumdb.html","summary":"Show help about vacuumdb command line arguments, and exit."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-vacuumdb.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-vacuumdb.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-vacuumdb.html","summary":"User name to connect as."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-vacuumdb.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Force vacuumdb to prompt for a password before connecting to a database. This option is never essential, since vacuumdb will automatically prompt for a password if the server demands password authentication. However, vacuumdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-vacuumdb.html","summary":"Force vacuumdb to prompt for a password before connecting to a database."},{"description":"When the -a / --all is used, connect to this database to gather the list of databases to vacuum. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname","source_url":"/docs/18/app-vacuumdb.html","summary":"When the -a / --all is used, connect to this database to gather the list of databases to vacuum. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"vacuumdb [ connection-option ...] [ option ...] [ -t | --table table [( column [,...] )] ] ... [ dbname | -a | --all ]\nvacuumdb [ connection-option ...] [ option ...] [ -n | --schema schema ] ... [ dbname | -a | --all ]\nvacuumdb [ connection-option ...] [ option ...] [ -N | --exclude-schema schema ] ... [ dbname | -a | --all ]","sources":[{"anchor":"","file":"app-vacuumdb.html","label":"18.6 English manual · app-vacuumdb.html","sha256":"bf6a6504348c7e0f81a39c49654524dcfebfc8f0ff7340d492daf13c64f76eb9","url":"/docs/18/app-vacuumdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["vacuumdb [ connection-option ...] [ option ...] [ -t | --table table [( column [,...] )] ] ... [ dbname | -a | --all ]","vacuumdb [ connection-option ...] [ option ...] [ -n | --schema schema ] ... [ dbname | -a | --all ]","vacuumdb [ connection-option ...] [ option ...] [ -N | --exclude-schema schema ] ... [ dbname | -a | --all ]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --all","url":"/docs/18/app-vacuumdb.html"},"summary":"Vacuum all databases."},{"signature":{"text":"--buffer-usage-limit size","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the Buffer Access Strategy ring buffer size for a given invocation of vacuumdb . This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See VACUUM ."},{"signature":{"text":"--disable-page-skipping","url":"/docs/18/app-vacuumdb.html"},"summary":"Disable skipping pages based on the contents of the visibility map."},{"signature":{"text":"-e --echo","url":"/docs/18/app-vacuumdb.html"},"summary":"Echo the commands that vacuumdb generates and sends to the server."},{"signature":{"text":"-f --full","url":"/docs/18/app-vacuumdb.html"},"summary":"Perform “ full ” vacuuming."},{"signature":{"text":"-F --freeze","url":"/docs/18/app-vacuumdb.html"},"summary":"Aggressively “ freeze ” tuples."},{"signature":{"text":"--force-index-cleanup","url":"/docs/18/app-vacuumdb.html"},"summary":"Always remove index entries pointing to dead tuples."},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-vacuumdb.html"},"summary":"Execute the vacuum or analyze commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"signature":{"text":"--min-mxid-age mxid_age","url":"/docs/18/app-vacuumdb.html"},"summary":"Only execute the vacuum or analyze commands on tables with a multixact ID age of at least mxid_age . This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see Section 24.1.5.1 )."},{"signature":{"text":"--min-xid-age xid_age","url":"/docs/18/app-vacuumdb.html"},"summary":"Only execute the vacuum or analyze commands on tables with a transaction ID age of at least xid_age . This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see Section 24.1.5 )."},{"signature":{"text":"--missing-stats-only","url":"/docs/18/app-vacuumdb.html"},"summary":"Only analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with --analyze-in-stages , this option prevents vacuumdb from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices."},{"signature":{"text":"-n schema --schema= schema","url":"/docs/18/app-vacuumdb.html"},"summary":"Clean or analyze all tables in schema only. Multiple schemas can be vacuumed by writing multiple -n switches."},{"signature":{"text":"-N schema --exclude-schema= schema","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not clean or analyze any tables in schema . Multiple schemas can be excluded by writing multiple -N switches."},{"signature":{"text":"--no-index-cleanup","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not remove index entries pointing to dead tuples."},{"signature":{"text":"--no-process-main","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip the main relation."},{"signature":{"text":"--no-process-toast","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip the TOAST table associated with the table to vacuum, if any."},{"signature":{"text":"--no-truncate","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not truncate empty pages at the end of the table."},{"signature":{"text":"-P parallel_workers --parallel= parallel_workers","url":"/docs/18/app-vacuumdb.html"},"summary":"Specify the number of parallel workers for parallel vacuum . This allows the vacuum to leverage multiple CPUs to process indexes. See VACUUM ."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not display progress messages."},{"signature":{"text":"--skip-locked","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip relations that cannot be immediately locked for processing."},{"signature":{"text":"-t table [ ( column [,...]) ] --table= table [ ( column [,...]) ]","url":"/docs/18/app-vacuumdb.html"},"summary":"Clean or analyze table only. Column names can be specified only in conjunction with the --analyze or --analyze-only options. Multiple tables can be vacuumed by writing multiple -t switches."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-vacuumdb.html"},"summary":"Print detailed information during processing."},{"signature":{"text":"-V --version","url":"/docs/18/app-vacuumdb.html"},"summary":"Print the vacuumdb version and exit."},{"signature":{"text":"-z --analyze","url":"/docs/18/app-vacuumdb.html"},"summary":"Also calculate statistics for use by the optimizer."},{"signature":{"text":"-Z --analyze-only","url":"/docs/18/app-vacuumdb.html"},"summary":"Only calculate statistics for use by the optimizer (no vacuum)."},{"signature":{"text":"--analyze-in-stages","url":"/docs/18/app-vacuumdb.html"},"summary":"Only calculate statistics for use by the optimizer (no vacuum), like --analyze-only . Run three stages of analyze; the first stage uses the lowest possible statistics target (see default_statistics_target ) to produce usable statistics faster, and subsequent stages build the full statistics."},{"signature":{"text":"-? --help","url":"/docs/18/app-vacuumdb.html"},"summary":"Show help about vacuumdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-vacuumdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-vacuumdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-vacuumdb.html"},"summary":"Force vacuumdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-vacuumdb.html"},"summary":"When the -a / --all is used, connect to this database to gather the list of databases to vacuum. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]},"ManualEvidence":{"manual_path":"app-vacuumdb.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-vacuumdb.html","label":"18.6 English manual · app-vacuumdb.html","sha256":"bf6a6504348c7e0f81a39c49654524dcfebfc8f0ff7340d492daf13c64f76eb9","url":"/docs/18/app-vacuumdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"vacuumdb","SourceDatabase":"center","Version":"18","Locale":"en","Title":"vacuumdb","Summary":"vacuumdb — garbage-collect and analyze a PostgreSQL database","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-VACUUMDB\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003evacuumdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003evacuumdb — garbage-collect and analyze a \u003cspan\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.23.4.1\"\u003e\u003ccode\u003evacuumdb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode\u003e-t\u003c/code\u003e | \u003ccode\u003e--table\u003c/code\u003e \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [( \u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...] )] ] ... [ \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode\u003e-a\u003c/code\u003e | \u003ccode\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.23.4.2\"\u003e\u003ccode\u003evacuumdb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode\u003e-n\u003c/code\u003e | \u003ccode\u003e--schema\u003c/code\u003e \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode\u003e-a\u003c/code\u003e | \u003ccode\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.23.4.3\"\u003e\u003ccode\u003evacuumdb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode\u003e-N\u003c/code\u003e | \u003ccode\u003e--exclude-schema\u003c/code\u003e \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode\u003e-a\u003c/code\u003e | \u003ccode\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003evacuumdb\u003c/span\u003e is a utility for cleaning a \u003cspan\u003ePostgreSQL\u003c/span\u003e database. \u003cspan\u003evacuumdb\u003c/span\u003e will also generate internal statistics used by the \u003cspan\u003ePostgreSQL\u003c/span\u003e query optimizer.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003evacuumdb\u003c/span\u003e is a wrapper around the SQL command \u003ca href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\" rel=\"nofollow\"\u003e\u003ccode\u003eVACUUM\u003c/code\u003e\u003c/a\u003e. There is no effective difference between vacuuming and analyzing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003evacuumdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eVacuum all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--buffer-usage-limit \u003cem\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the \u003ca href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\" rel=\"nofollow\"\u003e\u003c/a\u003e\u003ca href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\" title=\"Buffer Access Strategy\" rel=\"nofollow\"\u003eBuffer Access Strategy\u003c/a\u003e ring buffer size for a given invocation of \u003cspan\u003evacuumdb\u003c/span\u003e. This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See \u003ca href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\" rel=\"nofollow\"\u003e\u003cspan\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e[\u003cspan\u003e-d\u003c/span\u003e] \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e[\u003cspan\u003e--dbname=\u003c/span\u003e]\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be cleaned or analyzed, when \u003ccode\u003e-a\u003c/code\u003e/\u003ccode\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-page-skipping\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisable skipping pages based on the contents of the visibility map.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan\u003evacuumdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-f\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--full\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePerform \u003cspan\u003e“\u003cspan\u003efull\u003c/span\u003e”\u003c/span\u003e vacuuming.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-F\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--freeze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAggressively \u003cspan\u003e“\u003cspan\u003efreeze\u003c/span\u003e”\u003c/span\u003e tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--force-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlways remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-j \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--jobs=\u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the vacuum or analyze commands in parallel by running \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003evacuumdb\u003c/span\u003e will open \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\" rel=\"nofollow\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that using this mode together with the \u003ccode\u003e-f\u003c/code\u003e (\u003ccode\u003eFULL\u003c/code\u003e) option might cause deadlock failures if certain system catalogs are processed in parallel.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--min-mxid-age \u003cem\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a multixact ID age of at least \u003cem\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see \u003ca href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-MULTIXACT-WRAPAROUND\" rel=\"nofollow\"\u003eSection 24.1.5.1\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the multixact ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--min-xid-age \u003cem\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a transaction ID age of at least \u003cem\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see \u003ca href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND\" rel=\"nofollow\"\u003eSection 24.1.5\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the transaction ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--missing-stats-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with \u003ccode\u003e--analyze-in-stages\u003c/code\u003e, this option prevents \u003cspan\u003evacuumdb\u003c/span\u003e from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices.\u003c/p\u003e\n\u003cp\u003eThis option can only be used in conjunction with \u003ccode\u003e--analyze-only\u003c/code\u003e or \u003ccode\u003e--analyze-in-stages\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eNote that \u003ccode\u003e--missing-stats-only\u003c/code\u003e requires \u003ccode\u003eSELECT\u003c/code\u003e privileges on \u003ca href=\"/docs/18/catalog-pg-statistic.html\" rel=\"nofollow\"\u003e\u003ccode\u003epg_statistic\u003c/code\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/catalog-pg-statistic-ext-data.html\" rel=\"nofollow\"\u003e\u003ccode\u003epg_statistic_ext_data\u003c/code\u003e\u003c/a\u003e, which are restricted to superusers by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-n \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--schema=\u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze all tables in \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be vacuumed by writing multiple \u003ccode\u003e-n\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-N \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--exclude-schema=\u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not clean or analyze any tables in \u003cem\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e. Multiple schemas can be excluded by writing multiple \u003ccode\u003e-N\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-process-main\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the main relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-process-toast\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the TOAST table associated with the table to vacuum, if any.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-truncate\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not truncate empty pages at the end of the table.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-P \u003cem\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--parallel=\u003cem\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the number of parallel workers for \u003cem\u003eparallel vacuum\u003c/em\u003e. This allows the vacuum to leverage multiple CPUs to process indexes. See \u003ca href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\" rel=\"nofollow\"\u003e\u003cspan\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--skip-locked\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip relations that cannot be immediately locked for processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--table=\u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Column names can be specified only in conjunction with the \u003ccode\u003e--analyze\u003c/code\u003e or \u003ccode\u003e--analyze-only\u003c/code\u003e options. Multiple tables can be vacuumed by writing multiple \u003ccode\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eTip\u003c/h3\u003e\n\u003cp\u003eIf you specify columns, you probably have to escape the parentheses from the shell. (See examples below.)\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003evacuumdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--analyze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlso calculate statistics for use by the optimizer.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-Z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--analyze-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--analyze-in-stages\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum), like \u003ccode\u003e--analyze-only\u003c/code\u003e. Run three stages of analyze; the first stage uses the lowest possible statistics target (see \u003ca href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\" rel=\"nofollow\"\u003edefault_statistics_target\u003c/a\u003e) to produce usable statistics faster, and subsequent stages build the full statistics.\u003c/p\u003e\n\u003cp\u003eThis option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by \u003ccode\u003epg_upgrade\u003c/code\u003e. Be aware that running with this option in a database with existing statistics may cause the query optimizer choices to become transiently worse due to the low statistics targets of the early stages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003evacuumdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan\u003evacuumdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003evacuumdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003evacuumdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003evacuumdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--maintenance-db=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode\u003e-a\u003c/code\u003e/\u003ccode\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to vacuum. If not specified, the \u003ccode\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\" rel=\"nofollow\"\u003e\u003cspan\u003eVACUUM\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo clean the database \u003ccode\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003evacuumdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean and analyze for the optimizer a database named \u003ccode\u003ebigdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003evacuumdb --analyze bigdb\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean a single table \u003ccode\u003efoo\u003c/code\u003e in a database named \u003ccode\u003exyzzy\u003c/code\u003e, and analyze a single column \u003ccode\u003ebar\u003c/code\u003e of the table for the optimizer:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003evacuumdb --analyze --verbose --table=\u0026#39;foo(bar)\u0026#39; xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean all tables in the \u003ccode\u003efoo\u003c/code\u003e and \u003ccode\u003ebar\u003c/code\u003e schemas in a database named \u003ccode\u003exyzzy\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003evacuumdb --schema=\u0026#39;foo\u0026#39; --schema=\u0026#39;bar\u0026#39; xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.23.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\" rel=\"nofollow\"\u003e\u003cspan\u003eVACUUM\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"7fb5f268ccbca3de33bfaf70126d48d5d756a86d96b282c76e17d7b4357b2bbb","Payload":{"description":["vacuumdb — garbage-collect and analyze a PostgreSQL database"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-VACUUMDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003evacuumdb — garbage-collect and analyze a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.1\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-t\u003c/code\u003e | \u003ccode class=\"option\"\u003e--table\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...] )] ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.2\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-n\u003c/code\u003e | \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.23.4.3\"\u003e\u003ccode class=\"command\"\u003evacuumdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e-N\u003c/code\u003e | \u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e ] ... [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e | \u003ccode class=\"option\"\u003e-a\u003c/code\u003e | \u003ccode class=\"option\"\u003e--all\u003c/code\u003e ]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e is a utility for cleaning a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also generate internal statistics used by the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e query optimizer.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e\u003c/a\u003e. There is no effective difference between vacuuming and analyzing databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--all\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eVacuum all databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--buffer-usage-limit \u003cem class=\"replaceable\"\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BUFFER-ACCESS-STRATEGY\" title=\"Buffer Access Strategy\"\u003eBuffer Access Strategy\u003c/a\u003e ring buffer size for a given invocation of \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e. This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e-d\u003c/span\u003e] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e[\u003cspan class=\"optional\"\u003e--dbname=\u003c/span\u003e]\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be cleaned or analyzed, when \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is not used. If this is not specified, the database name is read from the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e. If that is not set, the user name specified for the connection is used. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-page-skipping\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDisable skipping pages based on the contents of the visibility map.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--full\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePerform \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efull\u003c/span\u003e”\u003c/span\u003e vacuuming.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--freeze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAggressively \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efreeze\u003c/span\u003e”\u003c/span\u003e tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--force-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlways remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExecute the vacuum or analyze commands in parallel by running \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e commands simultaneously. This option may reduce the processing time but it also increases the load on the database server.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eNote that using this mode together with the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e (\u003ccode class=\"literal\"\u003eFULL\u003c/code\u003e) option might cause deadlock failures if certain system catalogs are processed in parallel.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--min-mxid-age \u003cem class=\"replaceable\"\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a multixact ID age of at least \u003cem class=\"replaceable\"\u003e\u003ccode\u003emxid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-MULTIXACT-WRAPAROUND\" title=\"24.1.5.1. Multixacts and Wraparound\"\u003eSection 24.1.5.1\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the multixact ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--min-xid-age \u003cem class=\"replaceable\"\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly execute the vacuum or analyze commands on tables with a transaction ID age of at least \u003cem class=\"replaceable\"\u003e\u003ccode\u003exid_age\u003c/code\u003e\u003c/em\u003e. This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND\" title=\"24.1.5. Preventing Transaction ID Wraparound Failures\"\u003eSection 24.1.5\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor the purposes of this option, the transaction ID age of a relation is the greatest of the ages of the main relation and its associated TOAST table, if one exists. Since the commands issued by \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will also process the TOAST table for the relation if necessary, it does not need to be considered separately.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--missing-stats-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with \u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e, this option prevents \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices.\u003c/p\u003e\n\u003cp\u003eThis option can only be used in conjunction with \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eNote that \u003ccode class=\"option\"\u003e--missing-stats-only\u003c/code\u003e requires \u003ccode class=\"literal\"\u003eSELECT\u003c/code\u003e privileges on \u003ca class=\"link\" href=\"/docs/18/catalog-pg-statistic.html\" title=\"52.51. pg_statistic\"\u003e\u003ccode class=\"structname\"\u003epg_statistic\u003c/code\u003e\u003c/a\u003e and \u003ca class=\"link\" href=\"/docs/18/catalog-pg-statistic-ext-data.html\" title=\"52.53. pg_statistic_ext_data\"\u003e\u003ccode class=\"structname\"\u003epg_statistic_ext_data\u003c/code\u003e\u003c/a\u003e, which are restricted to superusers by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze all tables in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e only. Multiple schemas can be vacuumed by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not clean or analyze any tables in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eschema\u003c/code\u003e\u003c/em\u003e. Multiple schemas can be excluded by writing multiple \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-index-cleanup\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not remove index entries pointing to dead tuples.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-process-main\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the main relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-process-toast\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip the TOAST table associated with the table to vacuum, if any.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-truncate\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not truncate empty pages at the end of the table.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--parallel=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eparallel_workers\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the number of parallel workers for \u003cem class=\"firstterm\"\u003eparallel vacuum\u003c/em\u003e. This allows the vacuum to leverage multiple CPUs to process indexes. See \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display progress messages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--skip-locked\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSkip relations that cannot be immediately locked for processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e [,...]) ]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eClean or analyze \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e only. Column names can be specified only in conjunction with the \u003ccode class=\"option\"\u003e--analyze\u003c/code\u003e or \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e options. Multiple tables can be vacuumed by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.\u003c/p\u003e\n\u003cdiv class=\"tip\"\u003e\n\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\n\u003cp\u003eIf you specify columns, you probably have to escape the parentheses from the shell. (See examples below.)\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint detailed information during processing.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAlso calculate statistics for use by the optimizer.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--analyze-in-stages\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly calculate statistics for use by the optimizer (no vacuum), like \u003ccode class=\"option\"\u003e--analyze-only\u003c/code\u003e. Run three stages of analyze; the first stage uses the lowest possible statistics target (see \u003ca class=\"xref\" href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\"\u003edefault_statistics_target\u003c/a\u003e) to produce usable statistics faster, and subsequent stages build the full statistics.\u003c/p\u003e\n\u003cp\u003eThis option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by \u003ccode class=\"command\"\u003epg_upgrade\u003c/code\u003e. Be aware that running with this option in a database with existing statistics may cause the query optimizer choices to become transiently worse due to the low statistics targets of the early stages.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003evacuumdb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the \u003ccode class=\"option\"\u003e-a\u003c/code\u003e/\u003ccode class=\"option\"\u003e--all\u003c/code\u003e is used, connect to this database to gather the list of databases to vacuum. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, or if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo clean the database \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb test\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean and analyze for the optimizer a database named \u003ccode class=\"literal\"\u003ebigdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --analyze bigdb\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean a single table \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e in a database named \u003ccode class=\"literal\"\u003exyzzy\u003c/code\u003e, and analyze a single column \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e of the table for the optimizer:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --analyze --verbose --table='foo(bar)' xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo clean all tables in the \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e and \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e schemas in a database named \u003ccode class=\"literal\"\u003exyzzy\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003evacuumdb --schema='foo' --schema='bar' xyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.23.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-vacuum.html\" title=\"VACUUM\"\u003e\u003cspan class=\"refentrytitle\"\u003eVACUUM\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --all","url":"/docs/18/app-vacuumdb.html"},"summary":"Vacuum all databases."},{"signature":{"text":"--buffer-usage-limit size","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the Buffer Access Strategy ring buffer size for a given invocation of vacuumdb . This size is used to calculate the number of shared buffers which will be reused as part of this strategy. See VACUUM ."},{"signature":{"text":"--disable-page-skipping","url":"/docs/18/app-vacuumdb.html"},"summary":"Disable skipping pages based on the contents of the visibility map."},{"signature":{"text":"-e --echo","url":"/docs/18/app-vacuumdb.html"},"summary":"Echo the commands that vacuumdb generates and sends to the server."},{"signature":{"text":"-f --full","url":"/docs/18/app-vacuumdb.html"},"summary":"Perform “ full ” vacuuming."},{"signature":{"text":"-F --freeze","url":"/docs/18/app-vacuumdb.html"},"summary":"Aggressively “ freeze ” tuples."},{"signature":{"text":"--force-index-cleanup","url":"/docs/18/app-vacuumdb.html"},"summary":"Always remove index entries pointing to dead tuples."},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-vacuumdb.html"},"summary":"Execute the vacuum or analyze commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server."},{"signature":{"text":"--min-mxid-age mxid_age","url":"/docs/18/app-vacuumdb.html"},"summary":"Only execute the vacuum or analyze commands on tables with a multixact ID age of at least mxid_age . This setting is useful for prioritizing tables to process to prevent multixact ID wraparound (see Section 24.1.5.1 )."},{"signature":{"text":"--min-xid-age xid_age","url":"/docs/18/app-vacuumdb.html"},"summary":"Only execute the vacuum or analyze commands on tables with a transaction ID age of at least xid_age . This setting is useful for prioritizing tables to process to prevent transaction ID wraparound (see Section 24.1.5 )."},{"signature":{"text":"--missing-stats-only","url":"/docs/18/app-vacuumdb.html"},"summary":"Only analyze relations that are missing statistics for a column, index expression, or extended statistics object. When used with --analyze-in-stages , this option prevents vacuumdb from temporarily replacing existing statistics with ones generated with lower statistics targets, thus avoiding transiently worse query optimizer choices."},{"signature":{"text":"-n schema --schema= schema","url":"/docs/18/app-vacuumdb.html"},"summary":"Clean or analyze all tables in schema only. Multiple schemas can be vacuumed by writing multiple -n switches."},{"signature":{"text":"-N schema --exclude-schema= schema","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not clean or analyze any tables in schema . Multiple schemas can be excluded by writing multiple -N switches."},{"signature":{"text":"--no-index-cleanup","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not remove index entries pointing to dead tuples."},{"signature":{"text":"--no-process-main","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip the main relation."},{"signature":{"text":"--no-process-toast","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip the TOAST table associated with the table to vacuum, if any."},{"signature":{"text":"--no-truncate","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not truncate empty pages at the end of the table."},{"signature":{"text":"-P parallel_workers --parallel= parallel_workers","url":"/docs/18/app-vacuumdb.html"},"summary":"Specify the number of parallel workers for parallel vacuum . This allows the vacuum to leverage multiple CPUs to process indexes. See VACUUM ."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-vacuumdb.html"},"summary":"Do not display progress messages."},{"signature":{"text":"--skip-locked","url":"/docs/18/app-vacuumdb.html"},"summary":"Skip relations that cannot be immediately locked for processing."},{"signature":{"text":"-t table [ ( column [,...]) ] --table= table [ ( column [,...]) ]","url":"/docs/18/app-vacuumdb.html"},"summary":"Clean or analyze table only. Column names can be specified only in conjunction with the --analyze or --analyze-only options. Multiple tables can be vacuumed by writing multiple -t switches."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-vacuumdb.html"},"summary":"Print detailed information during processing."},{"signature":{"text":"-V --version","url":"/docs/18/app-vacuumdb.html"},"summary":"Print the vacuumdb version and exit."},{"signature":{"text":"-z --analyze","url":"/docs/18/app-vacuumdb.html"},"summary":"Also calculate statistics for use by the optimizer."},{"signature":{"text":"-Z --analyze-only","url":"/docs/18/app-vacuumdb.html"},"summary":"Only calculate statistics for use by the optimizer (no vacuum)."},{"signature":{"text":"--analyze-in-stages","url":"/docs/18/app-vacuumdb.html"},"summary":"Only calculate statistics for use by the optimizer (no vacuum), like --analyze-only . Run three stages of analyze; the first stage uses the lowest possible statistics target (see default_statistics_target ) to produce usable statistics faster, and subsequent stages build the full statistics."},{"signature":{"text":"-? --help","url":"/docs/18/app-vacuumdb.html"},"summary":"Show help about vacuumdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-vacuumdb.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-vacuumdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-vacuumdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-vacuumdb.html"},"summary":"Force vacuumdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-vacuumdb.html"},"summary":"When the -a / --all is used, connect to this database to gather the list of databases to vacuum. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
