From b73a948bf0723ce424cf75ba23694e78c4c3aefd Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Mon, 24 Apr 2023 09:21:01 -0700 Subject: [PATCH v3 2/9] Restructure autovacuum daemon section. Add sect2/sect3 subsections to autovacuum sect1. Also reorder the content slightly for clarity. TODO Add some basic explanations of vacuuming and relfrozenxid advancement, since that now appears later on in the chapter. Alternatively, move the autovacuum daemon sect1 after the routine vacuuming sect1. --- doc/src/sgml/maintenance.sgml | 66 ++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index a6295c399..6a7ec7c1d 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -100,6 +100,8 @@ autovacuum workers' activity. + + Autovacuum Scheduling If several large tables all become eligible for vacuuming in a short amount of time, all autovacuum workers might become occupied with @@ -112,6 +114,8 @@ limits. + + Configurable thresholds for vacuuming Tables whose relfrozenxid value is more than transactions old are always @@ -159,7 +163,10 @@ vacuum insert threshold = vacuum base insert threshold + vacuum insert scale fac relfrozenxid; otherwise, only pages that have been modified since the last vacuum are scanned. + + + Configurable thresholds for <command>ANALYZE</command> For analyze, a similar condition is used: the threshold, defined as: @@ -168,20 +175,6 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu is compared to the total number of tuples inserted, updated, or deleted since the last ANALYZE. - - - Partitioned tables are not processed by autovacuum. Statistics - should be collected by running a manual ANALYZE when it is - first populated, and again whenever the distribution of data in its - partitions changes significantly. - - - - Temporary tables cannot be accessed by autovacuum. Therefore, - appropriate vacuum and analyze operations should be performed via - session SQL commands. - - The default thresholds and scale factors are taken from postgresql.conf, but it is possible to override them @@ -192,18 +185,25 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu used. See for more details on the global settings. + + - - When multiple workers are running, the autovacuum cost delay parameters - (see ) are - balanced among all the running workers, so that the - total I/O impact on the system is the same regardless of the number - of workers actually running. However, any workers processing tables whose - per-table autovacuum_vacuum_cost_delay or - autovacuum_vacuum_cost_limit storage parameters have been set - are not considered in the balancing algorithm. - + + Autovacuum Cost-based Delays + + When multiple workers are running, the autovacuum cost delay parameters + (see ) are + balanced among all the running workers, so that the + total I/O impact on the system is the same regardless of the number + of workers actually running. However, any workers processing tables whose + per-table autovacuum_vacuum_cost_delay or + autovacuum_vacuum_cost_limit storage parameters have been set + are not considered in the balancing algorithm. + + + + Autovacuum and Lock Conflicts Autovacuum workers generally don't block other commands. If a process attempts to acquire a lock that conflicts with the @@ -223,6 +223,24 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu effectively prevent autovacuums from ever completing. + + + + Limitations + + Partitioned tables are not processed by autovacuum. Statistics + should be collected by running a manual ANALYZE when it is + first populated, and again whenever the distribution of data in its + partitions changes significantly. + + + + Temporary tables cannot be accessed by autovacuum. Therefore, + appropriate vacuum and analyze operations should be performed via + session SQL commands. + + + -- 2.40.1