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

Commit cdbad24

Browse files
committed
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.
1 parent 05dd9fb commit cdbad24

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
784784
return;
785785

786786
/*
787-
* Report accumulated xact commit/rollback and I/O timings whenever we send
788-
* a normal tabstat message
787+
* Report and reset accumulated xact commit/rollback and I/O timings
788+
* whenever we send a normal tabstat message
789789
*/
790790
if (OidIsValid(tsmsg->m_databaseid))
791791
{
@@ -795,6 +795,8 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
795795
tsmsg->m_block_time_write = pgStatBlockTimeWrite;
796796
pgStatXactCommit = 0;
797797
pgStatXactRollback = 0;
798+
pgStatBlockTimeRead = 0;
799+
pgStatBlockTimeWrite = 0;
798800
}
799801
else
800802
{

0 commit comments

Comments
 (0)