pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix performance regression from session statistics.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix performance regression from session statistics.
@ 2021-09-16 09:12 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2021-09-16 09:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix performance regression from session statistics.

Session statistics, as introduced by 960869da08, had several shortcomings:

- an additional GetCurrentTimestamp() call that also impaired the accuracy of
  the data collected

  This can be avoided by passing the current timestamp we already have in
  pgstat_report_stat().

- an additional statistics UDP packet sent every 500ms

  This is solved by adding the new statistics to PgStat_MsgTabstat.
  This is conceptually ugly, because session statistics are not
  table statistics.  But the struct already contains data unrelated
  to tables, so there is not much damage done.

  Connection and disconnection are reported in separate messages, which
  reduces the number of additional messages to two messages per session and a
  slight increase in PgStat_MsgTabstat size (but the same number of table
  stats fit).

- Session time computation could overflow on systems where long is 32 bit.

Reported-By: Andres Freund <andres@anarazel.de>
Author: Andres Freund <andres@anarazel.de>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/20210801205501.nyxzxoelqoo4x2qc%40alap3.anarazel.de
Backpatch: 14-, where the feature was introduced.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/37a9aa659111c454386b7055dcd3809e45bc17de

Modified Files
--------------
src/backend/postmaster/pgstat.c             | 195 ++++++++++++++++++----------
src/backend/tcop/postgres.c                 |   2 +
src/backend/utils/activity/backend_status.c |   4 +-
src/include/pgstat.h                        |  34 +++--
src/tools/pgindent/typedefs.list            |   3 +-
5 files changed, 158 insertions(+), 80 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix performance regression from session statistics.
@ 2021-09-16 09:12 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2021-09-16 09:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix performance regression from session statistics.

Session statistics, as introduced by 960869da08, had several shortcomings:

- an additional GetCurrentTimestamp() call that also impaired the accuracy of
  the data collected

  This can be avoided by passing the current timestamp we already have in
  pgstat_report_stat().

- an additional statistics UDP packet sent every 500ms

  This is solved by adding the new statistics to PgStat_MsgTabstat.
  This is conceptually ugly, because session statistics are not
  table statistics.  But the struct already contains data unrelated
  to tables, so there is not much damage done.

  Connection and disconnection are reported in separate messages, which
  reduces the number of additional messages to two messages per session and a
  slight increase in PgStat_MsgTabstat size (but the same number of table
  stats fit).

- Session time computation could overflow on systems where long is 32 bit.

Reported-By: Andres Freund <andres@anarazel.de>
Author: Andres Freund <andres@anarazel.de>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/20210801205501.nyxzxoelqoo4x2qc%40alap3.anarazel.de
Backpatch: 14-, where the feature was introduced.

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7890a423470b3a763aa22faf69a44cb6a2df8f0e

Modified Files
--------------
src/backend/postmaster/pgstat.c             | 195 ++++++++++++++++++----------
src/backend/tcop/postgres.c                 |   2 +
src/backend/utils/activity/backend_status.c |   4 +-
src/include/pgstat.h                        |  34 +++--
src/tools/pgindent/typedefs.list            |   3 +-
5 files changed, 158 insertions(+), 80 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-09-16 09:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 09:12 pgsql: Fix performance regression from session statistics. Andres Freund <andres@anarazel.de>
2021-09-16 09:12 pgsql: Fix performance regression from session statistics. Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox