]> granicus.if.org Git - postgresql/commitdiff
Clear I/O timing counters after sending them to the stats collector.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 28 Apr 2012 19:11:13 +0000 (15:11 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 28 Apr 2012 19:11:13 +0000 (15:11 -0400)
This oversight caused the reported times to accumulate in an O(N^2)
fashion the longer a backend runs.

src/backend/postmaster/pgstat.c

index cc141dc980c599f3a9a9b7e35fc7cac8ea9098d2..ee3ad1060baf8f624f0114e0032b4e9fdb9feb96 100644 (file)
@@ -784,8 +784,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
                return;
 
        /*
-        * Report accumulated xact commit/rollback and I/O timings whenever we send
-        * a normal tabstat message
+        * Report and reset accumulated xact commit/rollback and I/O timings
+        * whenever we send a normal tabstat message
         */
        if (OidIsValid(tsmsg->m_databaseid))
        {
@@ -795,6 +795,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
                tsmsg->m_block_time_write = pgStatBlockTimeWrite;
                pgStatXactCommit = 0;
                pgStatXactRollback = 0;
+               pgStatBlockTimeRead = 0;
+               pgStatBlockTimeWrite = 0;
        }
        else
        {