Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-10-31 Thread Kyotaro HORIGUCHI
At Thu, 26 Oct 2017 12:42:23 +0200, Robert Haas  wrote 
in 
> On Thu, Oct 26, 2017 at 10:18 AM, Kyotaro HORIGUCHI
>  wrote:
> > Thank you. I forgot that point. Changed them so that the messages
> > are detected as msgids.
> 
> Committed, changing "aggressive" to "aggressively" in one place for
> correct English.

Thank you for commiting!

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-10-26 Thread Robert Haas
On Thu, Oct 26, 2017 at 10:18 AM, Kyotaro HORIGUCHI
 wrote:
> Thank you. I forgot that point. Changed them so that the messages
> are detected as msgids.

Committed, changing "aggressive" to "aggressively" in one place for
correct English.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-10-26 Thread Kyotaro HORIGUCHI
Thank you for the comment.

(Thank you Sawada-san for reviewng, too.)

At Thu, 19 Oct 2017 13:03:38 +0200, Alvaro Herrera  
wrote in <20171019110338.awwzc3y674co7wof@alvherre.pgsql>
> Kyotaro HORIGUCHI wrote:
> 
> > How about the followings?
> > 
> > "automatic [agressive ]vacuum of table \"%s..."
> > "[aggressive ]vacuuming \"%s..."
> 
> That form of log message seems acceptable to me (first one is missing a 'g').
> 
> In any case, please do not construct the sentence with %s expanding the
> word, because that is going to cause a problem for translations.  Use an
> 'if' test with two full sentences instead.  Yes, as Robert said, it's
> going to add more strings, but that's okay.

Thank you. I forgot that point. Changed them so that the messages
are detected as msgids.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
>From 7252bfc0fafcf9d4d38067913325cf82c88d1e1e Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi 
Date: Mon, 28 Aug 2017 13:12:25 +0900
Subject: [PATCH] Show "aggressive" or not in vacuum messages

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

diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 30b1c08..1080fcf 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -355,6 +355,7 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 	   params->log_min_duration))
 		{
 			StringInfoData buf;
+			char *msgfmt;
 
 			TimestampDifference(starttime, endtime, , );
 
@@ -373,7 +374,11 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 			 * emitting individual parts of the message when not applicable.
 			 */
 			initStringInfo();
-			appendStringInfo(, _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"),
+			if (aggressive)
+msgfmt = _("automatic aggressive vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			else
+msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			appendStringInfo(, msgfmt,
 			 get_database_name(MyDatabaseId),
 			 get_namespace_name(RelationGetNamespace(onerel)),
 			 RelationGetRelationName(onerel),
@@ -486,10 +491,16 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats,
 	pg_rusage_init();
 
 	relname = RelationGetRelationName(onerel);
-	ereport(elevel,
-			(errmsg("vacuuming \"%s.%s\"",
-	get_namespace_name(RelationGetNamespace(onerel)),
-	relname)));
+	if (aggressive)
+		ereport(elevel,
+(errmsg("aggressive vacuuming \"%s.%s\"",
+		get_namespace_name(RelationGetNamespace(onerel)),
+		relname)));
+	else
+		ereport(elevel,
+(errmsg("vacuuming \"%s.%s\"",
+		get_namespace_name(RelationGetNamespace(onerel)),
+		relname)));
 
 	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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-10-19 Thread Alvaro Herrera
Kyotaro HORIGUCHI wrote:

> How about the followings?
> 
> "automatic [agressive ]vacuum of table \"%s..."
> "[aggressive ]vacuuming \"%s..."

That form of log message seems acceptable to me (first one is missing a 'g').

In any case, please do not construct the sentence with %s expanding the
word, because that is going to cause a problem for translations.  Use an
'if' test with two full sentences instead.  Yes, as Robert said, it's
going to add more strings, but that's okay.

-- 
Álvaro Herrerahttps://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-10-19 Thread Masahiko Sawada
On Tue, Sep 5, 2017 at 3:41 PM, Kyotaro HORIGUCHI
 wrote:
> Thank you for the opinions.
>
> At Tue, 29 Aug 2017 15:00:57 +0900, Masahiko Sawada  
> wrote in 

Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-09-05 Thread Kyotaro HORIGUCHI
Hello,

At Mon, 28 Aug 2017 20:07:32 -0700, "David G. Johnston" 
 wrote in 

> On Mon, Aug 28, 2017 at 2:26 AM, Kyotaro HORIGUCHI <
> horiguchi.kyot...@lab.ntt.co.jp> wrote:
> 
> > https://www.postgresql.org/docs/devel/static/runtime-config-client.html
> >
> > > VACUUM performs an aggressive scan
> >
> 
> Maybe this should gets its own thread/patch but I'll tack this on here
> since it all seems related.
> 
> That paragraph you linked has a couple of typos:
> 
> "Although users can set this value anywhere from zero to two billions,
> VACUUM" ...
> 
> should be 'two billion' (i.e., drop the "s")

Sure. (and I would make the same mistake..)

> "...so that a periodical manual VACUUM has..."
> 
> 'periodic' - though the description in the linked 24.1.5 is somewhat
> clearer (and longer) - the gap exists for the benefit of routine vacuum
> invocations to detect the need for an aggressive vacuum as part of a normal
> operating cycle rather than the last routine vacuum being non-aggressive
> and shortly thereafter an auto-vacuum anti-wraparound run is performed.
> 
> Current:
> 
> VACUUM will silently limit the effective value to 95% of
> autovacuum_freeze_max_age, so that a periodical manual VACUUM has a chance
> to run before an anti-wraparound autovacuum is launched for the table.
> 
> My interpretation:
> 
> VACUUM will silently limit the effective value to 95% of
> autovacuum_freeze_max_age so that a normal scan has a window within which
> to detect the need to convert itself to an aggressive scan and preempt the
> need for an untimely autovacuum initiated anti-wraparound scan.

I haven't find the phrase "normal scan" in the documentation.
Instaed, it seems to me that it should be "normal VACUUMs" as
seen in 24.1.5, which is VACUUM command without FREEZE
option. ("normal index scan" is another thing.)

So more verbosely, the interpretation would be the following

| VACUUM will silently limit the effective value to 95% of
| autovacuum_freeze_max_age so that a periodic (manual) VACUUM
| without FREEZE option has a window within which to detect the
| need to convert itself to an aggressive VACUUM and preempt the
| need for an untimely autovacuum initiated anti-wraparound scan.

> As noted in the 24.1.5 that "normal scan" can be time scheduled or an
> update driven auto-vacuum one.  It could be manual (though not really
> periodic) if one is monitoring the aging and is notified to run on manually
> when the age falls within the gap.
> 
> "Aggressive" sounds right throughout all of this.
> 
> Up-thread:
> INFO:  vacuuming "public.it" in aggressive mode
> 
> Maybe:
> INFO:  aggressively vacuuming "public.it"
> INFO:  vacuuming "public.it"

Hmm. I believed that the 'vacuuming' is a noun and the phrase
seen in my patch just submitted is 'aggressive vacuuming'. But of
course it's highly probable that I'm wrong.

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

Yeah, this is just the same with mine.

> Having read the docs and come to understand what "aggressive" means two
> wordings work for me (i.e., leaving non-aggressive unadorned).



> David J.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-09-05 Thread Kyotaro HORIGUCHI
Thank you for the opinions.

At Tue, 29 Aug 2017 15:00:57 +0900, Masahiko Sawada  
wrote in 

Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-08-29 Thread Masahiko Sawada
On Tue, Aug 29, 2017 at 10:16 AM, Robert Haas  wrote:
> On Mon, Aug 28, 2017 at 5:26 AM, Kyotaro HORIGUCHI
>  wrote:
>> Currently the message shows the '%d skipped-frozen' message but
>> it is insufficient to verify the true effect. This is a patch to
>> show mode as 'aggressive' or 'normal' in the closing message of
>> vacuum. %d frozen-skipped when 'aggressive mode' shows the true
>> effect of ALL_FROZEN.
>>
>> I will add this patch to CF2017-09.
>
> I would be a bit inclined to somehow show aggressive if it's
> aggressive and not insert anything at all otherwise.  That'd probably
> require two separate translatable strings in each case, but maybe
> that's OK.
>
> What do other people think?

FWIW I prefer the Robert's idea; not insert anything if normal vacuum.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-08-28 Thread David G. Johnston
On Mon, Aug 28, 2017 at 2:26 AM, Kyotaro HORIGUCHI <
horiguchi.kyot...@lab.ntt.co.jp> wrote:

> https://www.postgresql.org/docs/devel/static/runtime-config-client.html
>
> >
> ​V​
> ACUUM performs an aggressive scan
>

​Maybe this should gets its own thread/patch but I'll tack this on here
since it all seems related.

​That paragraph you linked has a couple of typos:

"Although users can set this value anywhere from zero to two billions,
VACUUM" ...

should be 'two billion' (i.e., drop the "s")

"...so that a periodical manual VACUUM has..."

'periodic' - though the description in the linked 24.1.5 is somewhat
clearer (and longer) - the gap exists for the benefit of routine vacuum
invocations to detect the need for an aggressive vacuum as part of a normal
operating cycle rather than the last routine vacuum being non-aggressive
and shortly thereafter an auto-vacuum anti-wraparound run is performed.

Current:

VACUUM will silently limit the effective value to 95% of
autovacuum_freeze_max_age, so that a periodical manual VACUUM has a chance
to run before an anti-wraparound autovacuum is launched for the table.

My interpretation:

VACUUM will silently limit the effective value to 95% of
autovacuum_freeze_max_age so that a normal scan has a window within which
to detect the need to convert itself to an aggressive scan and preempt the
need for an untimely autovacuum initiated anti-wraparound scan.


As noted in the 24.1.5 that "normal scan" can be time scheduled or an
update driven auto-vacuum one.  It could be manual (though not really
periodic) if one is monitoring the aging and is notified to run on manually
when the age falls within the gap.

"Aggressive" sounds right throughout all of this.

Up-thread:
INFO:  vacuuming "public.it" in aggressive mode

Maybe:
INFO:  aggressively vacuuming "public.it"
INFO:  vacuuming "public.it"

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

could be:
LOG:  automatic aggressive vacuum of table
"postgres.public.pgbench_branches", index scans: 0

Having read the docs and come to understand what "aggressive" means two
wordings work for me (i.e., leaving non-aggressive unadorned).

David J.


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-08-28 Thread Robert Haas
On Mon, Aug 28, 2017 at 5:26 AM, Kyotaro HORIGUCHI
 wrote:
> Currently the message shows the '%d skipped-frozen' message but
> it is insufficient to verify the true effect. This is a patch to
> show mode as 'aggressive' or 'normal' in the closing message of
> vacuum. %d frozen-skipped when 'aggressive mode' shows the true
> effect of ALL_FROZEN.
>
> I will add this patch to CF2017-09.

I would be a bit inclined to somehow show aggressive if it's
aggressive and not insert anything at all otherwise.  That'd probably
require two separate translatable strings in each case, but maybe
that's OK.

What do other people think?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-08-28 Thread Kyotaro HORIGUCHI
Hello,

Currently the message shows the '%d skipped-frozen' message but
it is insufficient to verify the true effect. This is a patch to
show mode as 'aggressive' or 'normal' in the closing message of
vacuum. %d frozen-skipped when 'aggressive mode' shows the true
effect of ALL_FROZEN.

I will add this patch to CF2017-09.

At Tue, 4 Apr 2017 20:29:38 +0900, Masahiko Sawada  
wrote in 
> On Tue, Apr 4, 2017 at 10:09 AM, Kyotaro HORIGUCHI
>  wrote:
> > | =# 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.
> 
> I think we can use the word "aggressive" here since we already use the
> word "aggressive vacuum" in docs[1], but it might be easily
> misunderstood.
> 
> [1] https://www.postgresql.org/docs/9.6/static/routine-vacuuming.html
> 
> >Is it better to be "freezing" or something?
> 
> An another idea can be something like "prevent wraparound". The
> autovaucum process doing aggressive vacuum appears in pg_stat_activity
> with the word " (to prevent wraparound)". This word might be more
> user friendly IMO.

Hmm. This appears to be in several form.

https://www.postgresql.org/docs/devel/static/sql-vacuum.html

> aggressive “freezing” of tuples. ... Aggressive freezing

https://www.postgresql.org/docs/devel/static/routine-vacuuming.html

> VACUUM will perform an aggressive vacuum,
> an anti-wraparound autovacuum

https://www.postgresql.org/docs/devel/static/runtime-config-client.html

> ACUUM performs an aggressive scan

ps title

> (to prevent wraparound)

The nearest common wording seems to be just aggressive (vacuum)
so I left it alone in the attached patch.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
>From 009507d5ddb33229e4c866fef206962de39317cc Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi 
Date: Mon, 28 Aug 2017 13:12:25 +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 having no tuple
to freeze. This patch adds indication of "aggressive" or "normal" in
autovacuum logs and VACUUM VERBOSE message
---
 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 45b1859..71ecd50 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -373,10 +373,11 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 			 * emitting individual parts of the message when not applicable.
 			 */
 			initStringInfo();
-			appendStringInfo(, _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"),
+			appendStringInfo(, _("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(, _("pages: %u removed, %u remain, %u skipped due to pins, %u skipped frozen\n"),
 			 vacrelstats->pages_removed,
@@ -487,9 +488,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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-04-04 Thread Masahiko Sawada
On Tue, Apr 4, 2017 at 10:09 AM, Kyotaro HORIGUCHI
 wrote:
> Hello,
>
> At Fri, 31 Mar 2017 18:20:23 +0900, Masahiko Sawada  
> wrote in 
>> On Wed, Mar 29, 2017 at 12:46 PM, Kyotaro HORIGUCHI
>>  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.

I think we can use the word "aggressive" here since we already use the
word "aggressive vacuum" in docs[1], but it might be easily
misunderstood.

[1] https://www.postgresql.org/docs/9.6/static/routine-vacuuming.html

>Is it better to be "freezing" or something?

An another idea can be something like "prevent wraparound". The
autovaucum process doing aggressive vacuum appears in pg_stat_activity
with the word " (to prevent wraparound)". This word might be more
user friendly IMO.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-04-03 Thread Kyotaro HORIGUCHI
Hello,

At Fri, 31 Mar 2017 18:20:23 +0900, Masahiko Sawada  
wrote in 
> On Wed, Mar 29, 2017 at 12:46 PM, Kyotaro HORIGUCHI
>  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 
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();
-			appendStringInfo(, _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"),
+			appendStringInfo(, _("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(, _("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


Re: [HACKERS] show "aggressive" or not in autovacuum logs

2017-03-31 Thread Masahiko Sawada
On Wed, Mar 29, 2017 at 12:46 PM, Kyotaro HORIGUCHI
 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.

> 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?

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


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