From c434b4d6235cffdee8b913c431d6ea6622ea2964 Mon Sep 17 00:00:00 2001 From: Greg Nancarrow Date: Fri, 29 Oct 2021 19:46:25 +1100 Subject: [PATCH] Skip vacuum log report processing in lazy_scan_heap() if the log output is suppressed anyway due to the vacuum log-level. --- src/backend/access/heap/vacuumlazy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 05221cc1d6..f7fe3ed436 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -1626,6 +1626,13 @@ lazy_scan_heap(LVRelState *vacrel, VacuumParams *params, bool aggressive) if (vacrel->nindexes > 0 && vacrel->do_index_cleanup) update_index_statistics(vacrel); + /* + * Skip log report processing if the log output is going to be + * suppressed anyway due to the log level. + */ + if (!message_level_is_interesting(elevel)) + return; + /* * When the table has no indexes (i.e. in the one-pass strategy case), * make log report that lazy_vacuum_heap_rel would've made had there been -- 2.27.0