mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Add log_autoanalyze_min_duration
The log output functionality of log_autovacuum_min_duration applies to both VACUUM and ANALYZE, so it is not possible to separate the VACUUM and ANALYZE log output thresholds. Logs are likely to be output only for VACUUM and not for ANALYZE. Therefore, we decided to separate the threshold for log output of VACUUM by autovacuum (log_autovacuum_min_duration) and the threshold for log output of ANALYZE by autovacuum (log_autoanalyze_min_duration). Author: Shinya Kato <shinya11.kato@gmail.com> Reviewed-by: Kasahara Tatsuhito <kasaharatt@oss.nttdata.com> Discussion: https://www.postgresql.org/message-id/flat/CAOzEurQtfV4MxJiWT-XDnimEeZAY+rgzVSLe8YsyEKhZcajzSA@mail.gmail.com
This commit is contained in:
@@ -322,12 +322,21 @@ static relopt_int intRelOpts[] =
|
||||
{
|
||||
{
|
||||
"log_autovacuum_min_duration",
|
||||
"Sets the minimum execution time above which autovacuum actions will be logged",
|
||||
"Sets the minimum execution time above which vacuum actions by autovacuum will be logged",
|
||||
RELOPT_KIND_HEAP | RELOPT_KIND_TOAST,
|
||||
ShareUpdateExclusiveLock
|
||||
},
|
||||
-1, -1, INT_MAX
|
||||
},
|
||||
{
|
||||
{
|
||||
"log_autoanalyze_min_duration",
|
||||
"Sets the minimum execution time above which analyze actions by autovacuum will be logged",
|
||||
RELOPT_KIND_HEAP,
|
||||
ShareUpdateExclusiveLock
|
||||
},
|
||||
-1, -1, INT_MAX
|
||||
},
|
||||
{
|
||||
{
|
||||
"toast_tuple_target",
|
||||
@@ -1895,7 +1904,9 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
|
||||
{"autovacuum_multixact_freeze_table_age", RELOPT_TYPE_INT,
|
||||
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_table_age)},
|
||||
{"log_autovacuum_min_duration", RELOPT_TYPE_INT,
|
||||
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_min_duration)},
|
||||
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_vacuum_min_duration)},
|
||||
{"log_autoanalyze_min_duration", RELOPT_TYPE_INT,
|
||||
offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_analyze_min_duration)},
|
||||
{"toast_tuple_target", RELOPT_TYPE_INT,
|
||||
offsetof(StdRdOptions, toast_tuple_target)},
|
||||
{"autovacuum_vacuum_cost_delay", RELOPT_TYPE_REAL,
|
||||
|
||||
@@ -648,7 +648,7 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
|
||||
|
||||
verbose = (params.options & VACOPT_VERBOSE) != 0;
|
||||
instrument = (verbose || (AmAutoVacuumWorkerProcess() &&
|
||||
params.log_min_duration >= 0));
|
||||
params.log_vacuum_min_duration >= 0));
|
||||
if (instrument)
|
||||
{
|
||||
pg_rusage_init(&ru0);
|
||||
@@ -959,9 +959,9 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
|
||||
{
|
||||
TimestampTz endtime = GetCurrentTimestamp();
|
||||
|
||||
if (verbose || params.log_min_duration == 0 ||
|
||||
if (verbose || params.log_vacuum_min_duration == 0 ||
|
||||
TimestampDifferenceExceeds(starttime, endtime,
|
||||
params.log_min_duration))
|
||||
params.log_vacuum_min_duration))
|
||||
{
|
||||
long secs_dur;
|
||||
int usecs_dur;
|
||||
|
||||
Reference in New Issue
Block a user