Make lazy_vacuum_rel call pg_rusage_init only if needed.
authorRobert Haas <rhaas@postgresql.org>
Thu, 18 Aug 2011 13:55:04 +0000 (09:55 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 18 Aug 2011 13:55:04 +0000 (09:55 -0400)
do_analyze_rel already does it this way.

Euler Taveira de Oliveira

src/backend/commands/vacuumlazy.c

index c5bf32e00fa8a1fed84a3c6758b68c29a51cd57d..b5547c5e757cd5e2fa3ccdf54d559db3d6ecff8a 100644 (file)
@@ -155,11 +155,13 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
        bool            scan_all;
        TransactionId freezeTableLimit;
 
-       pg_rusage_init(&ru0);
-
        /* measure elapsed time iff autovacuum logging requires it */
-       if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration > 0)
-               starttime = GetCurrentTimestamp();
+       if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
+       {
+               pg_rusage_init(&ru0);
+               if (Log_autovacuum_min_duration > 0)
+                       starttime = GetCurrentTimestamp();
+       }
 
        if (vacstmt->options & VACOPT_VERBOSE)
                elevel = INFO;