[HACKERS] [PATCH] Make sure all statistics is sent after a few DML areperformed - Mailing list pgsql-hackers

From Yugo Nagata
Subject [HACKERS] [PATCH] Make sure all statistics is sent after a few DML areperformed
Date
Msg-id 20170718214927.e2addf4a.nagata@sraoss.co.jp
Whole thread Raw
Responses Re: [HACKERS] [PATCH] Make sure all statistics is sent after a fewDML are performed
List pgsql-hackers
Hi,

After a DML is perfomed, the statistics is sent to pgstat by pgsent_report_sent().
However, the mininum time between stas file update is PGSTAT_STAT_INTERVAL, so if
a few DMLs are performed with short interval, some statistics could not be sent
until the backend is shutdown.

This is not a problem in usual cases, but in case that a session is remained in
idle for a long time, for example when using connection pooling, statistics of
a huge change of a table is not sent for a long time, and as a result, starting
autovacuum might be delayed.

An idea to resolve this is call pgsent_report_sent() again with a delay
after the last DML to make sure to send the statistics. The attached patch
implements this.

Any comments would be appreciated.

Regards,

-- 
Yugo Nagata <nagata@sraoss.co.jp>

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] merge psql ef/ev sf/sv handling functions
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] [PATCH] Make sure all statistics is sent after a fewDML are performed