Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0f7acbe

Browse files
committed
Make lazy_vacuum_rel call pg_rusage_init only if needed.
do_analyze_rel already does it this way. Euler Taveira de Oliveira
1 parent 24bf155 commit 0f7acbe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/commands/vacuumlazy.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,13 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
155155
bool scan_all;
156156
TransactionId freezeTableLimit;
157157

158-
pg_rusage_init(&ru0);
159-
160158
/* measure elapsed time iff autovacuum logging requires it */
161-
if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration > 0)
162-
starttime = GetCurrentTimestamp();
159+
if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
160+
{
161+
pg_rusage_init(&ru0);
162+
if (Log_autovacuum_min_duration > 0)
163+
starttime = GetCurrentTimestamp();
164+
}
163165

164166
if (vacstmt->options & VACOPT_VERBOSE)
165167
elevel = INFO;

0 commit comments

Comments
 (0)