Re: Table-level log_autovacuum_min_duration - Mailing list pgsql-hackers

From Naoya Anzai
Subject Re: Table-level log_autovacuum_min_duration
Date
Msg-id 116262CF971C844FB6E793F8809B51C6E361A1@BPXM02GP.gisp.nec.co.jp
Whole thread Raw
In response to Re: Table-level log_autovacuum_min_duration  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Table-level log_autovacuum_min_duration  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Thanks for your reply.

>> Feature test
>> ====================
(snip)
> I thought about using a
> special value like -2 to define the behavior you are mentioning here,
> aka with "-2" disable custom value and GUC parameter but I don't think
> it is worth adding as that's an ugly 3 line of code of this type:
> if (log_min_duration == -2)
>    enforce_log_min = -1;

I disscussed about this use case with my co-workers, who said
"that code is not good", then we concluded that it was actually
a rare case. If such a case sometimes happens in fact, I (or someone)
will suggest a different way from this patch to handle this case.

We know there is a practical workaround. :)

>> Coding review
>> ====================
>> I think description of log_autovacuum_min_duration in reloptions.c
>> (line:215) should be like other parameters (match with guc.c). So
>> it should be "Sets the minimum execution time above which autovacuum
>> actions will be logged." but not "Log autovacuum execution for
>> given threshold".
>
>What about that then?
>"Minimum execution time above which autovacuum actions will be logged"

That's roughly match. For matching with guc.c, you might be better to
add "Sets the" to that discription.

>> Architecture review
>> ====================
>> About the modification of gram.y.
>>
>> I think it is not good that log_min_duration is initialized to
>> zeros in gram.y when "FREEZE" option is set. Because any VACUUM
>> queries never use this parameter. I think log_min_duration always
>> should be initialized to -1.
>
>Looking at this patch this morning, actually I think that my last
>patch as well as your suggestion are both wrong. To put it in short
>words, log_min_duration should be set only if VACOPT_VERBOSE is
>defined in query declaration. So I changed this portion of the patch
>this way.

>And I forgot to change VacuumStmt for the ANALYZE portion in gram.y...
>Patch updated attached.

Sorry, I could not correctly express my opinion to you. I mean
"log_autovacuum_min_duration" is used only by AutoVacuum, Any VACUUM
queries (including VACUUM VERBOSE) never use this parameter. So,
when someone executes Manual Vacuum, "log_min_duration" always should
be initialized to -1.

ANALYZE should also be the same.

In other words, it is not necessary to initialize "log_min_duration"
to zero when perform the VACUUM(or ANALYZE) VERBOSE. "VERBOSE" is
provided only for changing the log level of Manual VACUUM from
DEBUG2 to INFO.

Regards,
-----
Naoya.



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: RangeType internal use
Next
From: Amit Kapila
Date:
Subject: Re: Parallel Seq Scan