From cdbad241f41362aaf09f913722a541e04e048742 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 28 Apr 2012 15:11:13 -0400 Subject: [PATCH] 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. --- src/backend/postmaster/pgstat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 { -- 2.40.0