mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
Add log_min_autovacuum_duration per-table option
This is useful to control autovacuum log volume, for situations where monitoring only a set of tables is necessary. Author: Michael Paquier Reviewed by: A team led by Naoya Anzai (also including Akira Kurosawa, Taiki Kondo, Huong Dangminh), Fujii Masao.
This commit is contained in:
@@ -196,7 +196,7 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
|
||||
Assert(params != NULL);
|
||||
|
||||
/* measure elapsed time iff autovacuum logging requires it */
|
||||
if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
|
||||
if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
{
|
||||
pg_rusage_init(&ru0);
|
||||
starttime = GetCurrentTimestamp();
|
||||
@@ -328,13 +328,13 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
|
||||
vacrelstats->new_dead_tuples);
|
||||
|
||||
/* and log the action if appropriate */
|
||||
if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
|
||||
if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
{
|
||||
TimestampTz endtime = GetCurrentTimestamp();
|
||||
|
||||
if (Log_autovacuum_min_duration == 0 ||
|
||||
if (params->log_min_duration == 0 ||
|
||||
TimestampDifferenceExceeds(starttime, endtime,
|
||||
Log_autovacuum_min_duration))
|
||||
params->log_min_duration))
|
||||
{
|
||||
StringInfoData buf;
|
||||
TimestampDifference(starttime, endtime, &secs, &usecs);
|
||||
|
Reference in New Issue
Block a user