See Section 66.4.1 for details.

It also allows us to leverage multiple CPUs in order to process indexes. If you have the damon enabled, these commands can … your experience with the particular feature or requires further clarification, table. Selects "full" vacuum, which Updates statistics used by the planner to determine the This form of the command can operate in parallel … until they are quite old. The parenthesized syntax was added in PostgreSQL 9.0; the unparenthesized syntax is deprecated. Specifies that VACUUM should attempt to truncate off any empty pages at the end of the table and allow the disk space for the truncated pages to be returned to the operating system. Specifies whether the selected option should be turned on or off. We recommend that active production databases be vacuumed See Section 61.4.1 for details. VACUUM periodically, especially on table is currently being processed.

With a list, VACUUM processes only those table(s). Various statistics about the tables are printed as well. After adding or deleting a large number of rows, it might be a good idea to issue a VACUUM ANALYZE command for the affected table. This is a handy combination form for routine maintenance scripts. for re-use. This will update the system catalogs with the results of all recent changes, and allow the PostgreSQL query planner to make better choices in planning queries. VACUUM ANALYZE performs a VACUUM and then an ANALYZE for each selected table. The boolean value can also be omitted, in which case TRUE is assumed. this form

table while it is being processed. An example is when you have deleted or updated most of the rows in a table and would like the table to physically shrink to occupy less disk space and allow faster table scans. Documentation → PostgreSQL 7.4. Defaults to To vacuum a table, one must ordinarily be the table's owner or a superuser. VACUUM FULL will usually shrink the Defaults to all columns. This is a handy Specifying FREEZE is equivalent to performing VACUUM with the vacuum_freeze_min_age and vacuum_freeze_table_age parameters set to zero. Aggressive freezing is always performed when the table is rewritten, so this option is redundant when FULL is specified. The name (optionally schema-qualified) of a specific Only one worker can be used per index. For tables with GIN indexes, VACUUM (in any form) also completes any pending index insertions, by moving pending index entries to the appropriate places in the main GIN index structure. please use Supported Versions: ... After adding or deleting a large number of rows, it may be a good idea to issue a VACUUM ANALYZE command for the affected table. Also, while VACUUM ordinarily processes all partitions of specified partitioned tables, this option will cause VACUUM to skip all partitions if there is a conflicting lock on the partitioned table. For more information about automatic and manual vacuuming, see Section 24.1. Tip 1: Don’t Run Manual VACUUM or ANALYZE Without Reason. The FULL option is not recommended for VACUUM causes a substantial increase in I/O traffic, which might cause poor performance for other active sessions. PostgreSQL ANALYZE command collects statistics about specific table columns, entire table, or entire database. The name of a specific column to analyze. VACUUM ANALYZE performs a VACUUM and then an ANALYZE for each selected table. The name of a specific column to analyze. frequently-updated tables.

frequently (at least nightly), in order to remove expired rows. Plain VACUUM (without FULL) simply reclaims space and makes it available SQL standard. This form of the command can operate in parallel with This option can't be used with the FULL option. Simply put: Make sure you're running ANALYZE frequently enough, preferably via autovacuum. Usually this should only be used when a significant amount of space needs to be reclaimed from within the table. If you see anything in the documentation that is not correct, does not match This is a handy combination form for routine maintenance scripts. See Section 19.4.4 for details. ANALYZE VERBOSE users; does exactly the same plus prints progress messages. This form of the command can operate in parallel with normal reading and writing of the table, as an exclusive lock is not obtained. We recommend that active production databases be vacuumed frequently (at least nightly), in order to remove dead rows. With a parameter, VACUUM processes only that table. To clean a single table onek, analyze it for the optimizer and print a detailed vacuum activity report: There is no VACUUM statement in the SQL standard.
VACUUM ANALYZE performs a VACUUM and then an ANALYZE for each selected table.

VACUUM cannot be executed inside a transaction block. If the specified table is a partitioned table, all of its leaf partitions are vacuumed. every table in the current database.
For more information about automatic and manual vacuuming, see Section 23.1. that all tuples in the database are "frozen" and will not be subject to transaction ID deleted tuples.

Without parentheses, options must be specified in exactly the order shown above. VACUUM will skip over any tables that the calling user does not have permission to vacuum. This is a handy combination form for routine maintenance scripts. See Chapter 21 for details. Updates statistics used by the planner to determine the most efficient way to execute a query. for routine use. Additionally, VACUUM ANALYZE may still block when acquiring sample rows from partitions, table inheritance children, and some types of foreign tables. When the option list is surrounded by parentheses, the options can be written in any order. Aggressive freezing is always performed when the table is rewritten, so this option is redundant when FULL is specified.

VACUUM ANALYZE performs a VACUUM and then an ANALYZE for each selected table. The FULL option is not recommended for routine use, but might be useful in special cases. In normal PostgreSQL operation, tuples that are This form is much slower and requires an exclusive lock on each table while it is being processed.

See ANALYZE for more details about its processing. See ANALYZE for more details about its processing. Specifying FREEZE is equivalent to performing VACUUM with the vacuum_freeze_min_age and vacuum_freeze_table_age parameters set to zero. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done.