From dd3ae378301f7e84c18f7a90f183c3cd4165c0da Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 15 Oct 2025 14:31:12 +0200 Subject: 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 Reviewed-by: Kasahara Tatsuhito Discussion: https://www.postgresql.org/message-id/flat/CAOzEurQtfV4MxJiWT-XDnimEeZAY+rgzVSLe8YsyEKhZcajzSA@mail.gmail.com --- src/backend/commands/analyze.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/analyze.c') diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 12b4f3fd36e..c2e216563c6 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -138,7 +138,7 @@ analyze_rel(Oid relid, RangeVar *relation, * Make sure to generate only logs for ANALYZE in this case. */ onerel = vacuum_open_relation(relid, relation, params.options & ~(VACOPT_VACUUM), - params.log_min_duration >= 0, + params.log_analyze_min_duration >= 0, ShareUpdateExclusiveLock); /* leave if relation could not be opened or locked */ @@ -310,7 +310,7 @@ do_analyze_rel(Relation onerel, const VacuumParams params, verbose = (params.options & VACOPT_VERBOSE) != 0; instrument = (verbose || (AmAutoVacuumWorkerProcess() && - params.log_min_duration >= 0)); + params.log_analyze_min_duration >= 0)); if (inh) ereport(elevel, (errmsg("analyzing \"%s.%s\" inheritance tree", @@ -735,9 +735,9 @@ do_analyze_rel(Relation onerel, const VacuumParams params, { TimestampTz endtime = GetCurrentTimestamp(); - if (verbose || params.log_min_duration == 0 || + if (verbose || params.log_analyze_min_duration == 0 || TimestampDifferenceExceeds(starttime, endtime, - params.log_min_duration)) + params.log_analyze_min_duration)) { long delay_in_ms; WalUsage walusage; -- cgit v1.2.3