From: Tom Lane Date: Sat, 28 Apr 2012 19:11:13 +0000 (-0400) Subject: Clear I/O timing counters after sending them to the stats collector. X-Git-Tag: REL9_2_BETA1~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdbad241f41362aaf09f913722a541e04e048742;p=postgresql Clear I/O timing counters after sending them to the stats collector. This oversight caused the reported times to accumulate in an O(N^2) fashion the longer a backend runs. --- diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index cc141dc980..ee3ad1060b 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -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 {