Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: magnus@hagander.net, Michael Paquier <michael@paquier.xyz>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org
Date: 2021-09-06T07:22:02Z
Lists: pgsql-hackers
Hi,

On 2021-09-06 09:12:58 +0200, Laurenz Albe wrote:
> Reading your patch, I am still confused about the following:
> There are potentially several calls to "pgstat_send_tabstat" in "pgstat_report_stat".
> It seems to me that if it were called more than once, session statistics would
> be reported and counted several times, which would be wrong.

The accumulator variables are set to zero after being sent. So no data should
be sent multiple times as far as I can tell.

Regards,

Andres



Commits

  1. Fix performance regression from session statistics.

  2. Add pg_stat_database counters for sessions and session time