summaryrefslogtreecommitdiff
path: root/src/backend/postmaster
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-10-15 14:31:12 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-10-15 14:31:12 +0200
commitdd3ae378301f7e84c18f7a90f183c3cd4165c0da (patch)
tree6de83d42ae4be0d0d1c29ed6255cd48e7809cdbc /src/backend/postmaster
parent12609fbacb007698ec91101b6464436506518346 (diff)
Add log_autoanalyze_min_duration
The log output functionality of log_autovacuum_min_duration applies to both VACUUM and ANALYZE, so it is not possible to separate the VACUUM and ANALYZE log output thresholds. Logs are likely to be output only for VACUUM and not for ANALYZE. Therefore, we decided to separate the threshold for log output of VACUUM by autovacuum (log_autovacuum_min_duration) and the threshold for log output of ANALYZE by autovacuum (log_autoanalyze_min_duration). Author: Shinya Kato <shinya11.kato@gmail.com> Reviewed-by: Kasahara Tatsuhito <kasaharatt@oss.nttdata.com> Discussion: https://www.postgresql.org/message-id/flat/CAOzEurQtfV4MxJiWT-XDnimEeZAY+rgzVSLe8YsyEKhZcajzSA@mail.gmail.com
Diffstat (limited to 'src/backend/postmaster')
-rw-r--r--src/backend/postmaster/autovacuum.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index fb5d3b27224..5084af7dfb6 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -133,6 +133,7 @@ double autovacuum_vac_cost_delay;
int autovacuum_vac_cost_limit;
int Log_autovacuum_min_duration = 600000;
+int Log_autoanalyze_min_duration = 600000;
/* the minimum allowed time between two awakenings of the launcher */
#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */
@@ -2814,7 +2815,8 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
int freeze_table_age;
int multixact_freeze_min_age;
int multixact_freeze_table_age;
- int log_min_duration;
+ int log_vacuum_min_duration;
+ int log_analyze_min_duration;
/*
* Calculate the vacuum cost parameters and the freeze ages. If there
@@ -2824,10 +2826,15 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
*/
/* -1 in autovac setting means use log_autovacuum_min_duration */
- log_min_duration = (avopts && avopts->log_min_duration >= 0)
- ? avopts->log_min_duration
+ log_vacuum_min_duration = (avopts && avopts->log_vacuum_min_duration >= 0)
+ ? avopts->log_vacuum_min_duration
: Log_autovacuum_min_duration;
+ /* -1 in autovac setting means use log_autoanalyze_min_duration */
+ log_analyze_min_duration = (avopts && avopts->log_analyze_min_duration >= 0)
+ ? avopts->log_analyze_min_duration
+ : Log_autoanalyze_min_duration;
+
/* these do not have autovacuum-specific settings */
freeze_min_age = (avopts && avopts->freeze_min_age >= 0)
? avopts->freeze_min_age
@@ -2877,7 +2884,8 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
tab->at_params.multixact_freeze_min_age = multixact_freeze_min_age;
tab->at_params.multixact_freeze_table_age = multixact_freeze_table_age;
tab->at_params.is_wraparound = wraparound;
- tab->at_params.log_min_duration = log_min_duration;
+ tab->at_params.log_vacuum_min_duration = log_vacuum_min_duration;
+ tab->at_params.log_analyze_min_duration = log_analyze_min_duration;
tab->at_params.toast_parent = InvalidOid;
/*