On Tue, 2021-08-24 at 15:12 +0900, Kyotaro Horiguchi wrote: > At Wed, 18 Aug 2021 05:16:38 +0200, Laurenz Albe <laurenz.a...@cybertec.at> > wrote in > > On Tue, 2021-08-17 at 02:14 -0700, Andres Freund wrote: > > > > > I'm also not all that happy with sending yet another UDP packet for > > > > > this. > > > > > > > > Are you suggesting that connection statistics should be shoehorned into > > > > some other statistics message? That would reduce the number of UDP > > > > packets, > > > > but it sounds ugly and confusing to me. > > > > > > That ship already has sailed. Look at struct PgStat_MsgTabstat > > > > > > Given that we transport number of commits/commits, block read/write time > > > adding the time the connection was active/inactive doesn't really seem > > > like it > > > makes things meaningfully worse? > > > > Point taken. > > > > I looked at the other statistics sent in pgstat_report_stat(), and I see > > none that are sent unconditionally. > > IIUC, that means that pg_stat_report sends at least one > PgStat_MsgTabstat struct for the database stats purpose if any stats > are sent. So the connection stats can piggy-back on the packet. > > No need to change the condition. It's sufficient that the connection > stats are sent at the same time with transaction stats are sent.
> > > Doubling the number of UDP messages in common workloads seems also > > > problematicenough that it should be addressed for 14. > > > > Ok, but I don't know how to go about it. > > The attached is a heavy-WIP on: > > - remove redundant gettimeofday(). > - avoid sending dedicate UCP packet for connection stats. Thank you. Perhaps I misread that, but doesn't that mean that the session statistics could be sent several times? "pgstat_send_tabstat()" could be called more than once, right? Yours, Laurenz Albe