model-writtenrun 6172 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund opened the thread by identifying a redundant timestamp calculation, inaccurate timing boundaries, and additional UDP traffic from session statistics, proposing either piggybacking on existing messages or separating live-session statistics from completed-session totals #1.
- Laurenz Albe emphasized the need to retain useful statistics for long-lived pooled connections and submitted a timestamp-reuse fix, while Andres argued that PgStat_MsgTabstat already carried database-wide counters and could also carry session statistics #2 #3 #4.
- Kyotaro Horiguchi reviewed the timestamp fix and supplied a broader prototype that moved connection statistics into table-statistics messages; when Laurenz questioned duplicate reporting, Kyotaro explained how transaction-counter resets limited effective reporting to one message #6 #7 #8.
- Michael Paquier questioned that abstraction and preferred reducing reporting frequency, while Kyotaro explored a separate proof of concept that accumulated live timings in backend status and sent connection statistics only at disconnect; Michael considered a larger redesign too risky near the PostgreSQL 14 release and raised reverting as a last resort #9 #11 #14.
- Laurenz proposed doubling the general reporting interval, but Michael objected to affecting all statistics and Andres explained that occasional-query workloads would still send extra messages; Laurenz then proposed a separate, much longer session-statistics interval, which was not used in the eventual patch #15 #16 #17 #20 #23.
- Andres supplied a new implementation that carried session timings in table-statistics messages while reporting connection and disconnection separately, and also fixed timing arithmetic that could overflow where long is 32 bits #24.
- Laurenz argued that WAL senders would skew ordinary-session statistics because their activity characteristics differ, accepted the accumulator-reset explanation, and revised Andres's patch to cache the last session-report timestamp and document the backend restriction #25 #26 #27 #28.
- Andres committed the final attachment as 37a9aa6591, with an additional shared predicate that also excluded non-normal backends from connect/disconnect counts, and closed the release open item #28 #32.
- The urgent fix was complete at the end of the thread, while WAL-sender inclusion remained a possible future policy change and regression tests were requested but not supplied; Laurenz explained the connection-pool sizing motivation, and Andres confirmed that the urgent PostgreSQL 14 issues were addressed #32 #33 #34 #35.