[PATCH] Make sure all statistics is sent after a few DML are performed

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Make sure all statistics is sent after a few DML are performed
Date: 2017-07-18 12:49:27
Message-ID: 20170718214927.e2addf4a.nagata@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
pgstat_report_stat.patch text/x-diff 4.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-07-18 13:06:44 Re: [PATCH] Make sure all statistics is sent after a few DML are performed
Previous Message Fabien COELHO 2017-07-18 12:40:37 Re: merge psql ef/ev sf/sv handling functions