From 235f5c8b31db8b81ff9735707c95128201131d2d Mon Sep 17 00:00:00 2001 From: Daniil Davidov Date: Sat, 28 Mar 2026 17:37:07 +0700 Subject: [PATCH v33 2/2] Documantation for parallel autovacuum --- doc/src/sgml/config.sgml | 19 ++++++++++++++ doc/src/sgml/maintenance.sgml | 42 ++++++++++++++++++++++++++++++ doc/src/sgml/ref/create_table.sgml | 18 +++++++++++++ doc/src/sgml/ref/vacuum.sgml | 24 +++-------------- 4 files changed, 83 insertions(+), 20 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 229f41353eb..cbe73172b2e 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2918,6 +2918,7 @@ include_dir 'conf.d' When changing this value, consider also adjusting , + , , and . @@ -9485,6 +9486,24 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; + + autovacuum_max_parallel_workers (integer) + + autovacuum_max_parallel_workers + configuration parameter + + + + + Sets the maximum number of parallel autovacuum workers that + can be used for the + by a single autovacuum worker. Is capped by . + The default is 0, which means no parallel index vacuuming for this + table. + + + + diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 0d2a28207ed..e350226610a 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -927,6 +927,13 @@ HINT: Execute a database-wide VACUUM in that database. autovacuum workers' activity. + + If an autovacuum worker process comes across a table with the enabled + storage parameter, + it will launch parallel workers in order to perform the + . + + If several large tables all become eligible for vacuuming in a short amount of time, all autovacuum workers might become occupied with @@ -1038,6 +1045,10 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu per-table autovacuum_vacuum_cost_delay or autovacuum_vacuum_cost_limit storage parameters have been set are not considered in the balancing algorithm. + Parallel workers launched for are using + the same cost delay parameters as the leader worker. If any of these + parameters are changed in the leader worker, it will propagate the new + parameter values to all of its parallel workers. @@ -1166,6 +1177,37 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu + + + Parallel Vacuum + + + Both VACUUM command and autovacuum daemon can perform + index vacuum and index cleanup phases in parallel using + integer background workers + (for the details of each vacuum phase, please refer to + ). The number of workers used to perform + the operation is equal to the number of indexes on the relation that + support parallel vacuum which may be further limited by the value specific + to VACUUM or autovacuum (see PARALLEL + option for or + , respectively). + + + + An index can participate in parallel vacuum if and only if the size of the + index is more than . + Please note that it is not guaranteed that the number of parallel workers + specified in integer will be + used during execution. It is possible for a vacuum to run with fewer + workers than specified, or even with no workers at all. Only one worker + can be used per index. So parallel workers are launched only when there + are at least 2 indexes in the table. Workers for + vacuum are launched before the start of each phase and exit at the end of + the phase. These behaviors might change in a future release. + + + diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 80829b23945..8f5b25411cd 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1738,6 +1738,24 @@ WITH ( MODULUS numeric_literal, REM + + autovacuum_parallel_workers (integer) + + autovacuum_parallel_workers storage parameter + + + + + Sets the maximum number of parallel autovacuum workers that can be used + for the . + The default value is 0, which means no parallel index vacuuming for + this table. If value is -1 then parallel degree will computed based on + number of indexes and limited by the + configuration parameter. + + + + autovacuum_vacuum_threshold, toast.autovacuum_vacuum_threshold (integer) diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index ac5d083d468..d3f32851386 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -81,7 +81,7 @@ VACUUM [ ( option [, ...] ) ] [ parallel vacuum. + indexes. This feature is known as . To disable this feature, one can use PARALLEL option and specify parallel workers as zero. VACUUM FULL rewrites the entire contents of the table into a new disk file with no extra space, @@ -266,25 +266,9 @@ VACUUM [ ( option [, ...] ) ] [ PARALLEL - Perform index vacuum and index cleanup phases of VACUUM - in parallel using integer - background workers (for the details of each vacuum phase, please - refer to ). The number of workers used - to perform the operation is equal to the number of indexes on the - relation that support parallel vacuum which is limited by the number of - workers specified with PARALLEL option if any which is - further limited by . - An index can participate in parallel vacuum if and only if the size of the - index is more than . - Please note that it is not guaranteed that the number of parallel workers - specified in integer will be - used during execution. It is possible for a vacuum to run with fewer - workers than specified, or even with no workers at all. Only one worker - can be used per index. So parallel workers are launched only when there - are at least 2 indexes in the table. Workers for - vacuum are launched before the start of each phase and exit at the end of - the phase. These behaviors might change in a future release. This - option can't be used with the FULL option. + Limits the number of parallel workers used to perform the + , which is further limited by + . -- 2.43.0