Hello,

At Fri, 31 Mar 2017 18:20:23 +0900, Masahiko Sawada <sawada.m...@gmail.com> 
wrote in <cad21aobn-hsih7hep8ey6nuwqgwyj0o7emuartas-6+cyaf...@mail.gmail.com>
> On Wed, Mar 29, 2017 at 12:46 PM, Kyotaro HORIGUCHI
> <horiguchi.kyot...@lab.ntt.co.jp> wrote:
> > 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.
> 
> Good idea. I also was thinking about this.

Thanks. Currently we cannot use "skipped-frozen" to see the
effect of ALL_FROZEN.

> > 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
> >
> 
> Should we add this even to the manual vacuum verbose message?

I forgot that. The patch adds the mode indication in the first
message of VACUUM VERBOSE.

| =# vacuum freeze verbose it;
| INFO:  vacuuming "public.it" in aggressive mode
| INFO:  "it": found 0 removable, 0 nonremovable row versions in 0 out of 0 
pages
...
| Skipped 0 pages due to buffer pins, 0 frozen pages.

I still feel a bit uneasy about the word "aggressive" here. Is it
better to be "freezing" or something?

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
>From 1027e08d096068f4841343a1adf6e4db61c0d218 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyot...@lab.ntt.co.jp>
Date: Tue, 4 Apr 2017 09:56:11 +0900
Subject: [PATCH] Show "aggressive" or not in vacuum messages

VACUUM VERBOSE or autovacuum emits log message with "n skipped-frozen"
but we cannot tell whether the vacuum was non-freezing (or not
aggressive) vacuum or freezing (or aggressive) vacuum with no tuple to
freeze. This patch adds indication of "aggressive" or "normal" in
autovacuum logs and VACUUM VERBOSE messages.
---
 src/backend/commands/vacuumlazy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 5b43a66..9d02327 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 individual parts 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,
@@ -488,9 +489,9 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats,
 
 	relname = RelationGetRelationName(onerel);
 	ereport(elevel,
-			(errmsg("vacuuming \"%s.%s\"",
+			(errmsg("vacuuming \"%s.%s\" in %s mode",
 					get_namespace_name(RelationGetNamespace(onerel)),
-					relname)));
+					relname, aggressive ? "aggressive" : "normal")));
 
 	empty_pages = vacuumed_pages = 0;
 	num_tuples = tups_vacuumed = nkeep = nunused = 0;
-- 
2.9.2

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to