show "aggressive" or not in autovacuum logs - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject show "aggressive" or not in autovacuum logs
Date
Msg-id 20170329.124649.193656100.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
Responses Re: show "aggressive" or not in autovacuum logs  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
Hello, it would be too late but I'd like to propose this because
this cannot be back-patched.


In autovacuum logs, "%u skipped frozen" shows the number of pages
skipped by ALL_FROZEN only in aggressive vacuum.

So users cannot tell whether '0 skipped-frozen' means a
non-agressive vacuum or no frozen-pages in an agressive vacuum.

I think it is nice to have an indication whether the scan was
"agressive" or not in log output. Like this,

> LOG:  automatic aggressive vacuum of table "template1.pg_catalog.pg_statistic": index scans: 0

"0 skipped frozen" is uesless in non-aggressive vacuum but
removing it would be too-much.  Inserting "aggressive" reduces
machine-readability so it might be better in another place. The
attached patch does the following.

>  LOG:  automatic vacuum of table "postgres.public.pgbench_branches": mode: normal, index scans: 0
>  LOG:  automatic vacuum of table "postgres.public.pgbench_branches": mode: aggressive, index scans: 0

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 5b43a66..644c93c 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -374,10 +374,11 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,             * emitting
individualparts of the message when not applicable.             */            initStringInfo(&buf);
 
-            appendStringInfo(&buf, _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"),
+            appendStringInfo(&buf, _("automatic vacuum of table \"%s.%s.%s\": mode: %s, index scans: %d\n"),
                 get_database_name(MyDatabaseId),
get_namespace_name(RelationGetNamespace(onerel)),                            RelationGetRelationName(onerel),
 
+                             aggressive ? "aggressive" : "normal",
vacrelstats->num_index_scans);           appendStringInfo(&buf, _("pages: %u removed, %u remain, %u skipped due to
pins,%u skipped frozen\n"),                             vacrelstats->pages_removed, 

pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: Refactor handling of database attributes betweenpg_dump and pg_dumpall
Next
From: Craig Ringer
Date:
Subject: Fix obsolete comment in GetSnapshotData