Обсуждение: pgsql: Add pg_stat_database counters for sessions and session time
Add pg_stat_database counters for sessions and session time This add counters for number of sessions, the different kind of session termination types, and timers for how much time is spent in active vs idle in a database to pg_stat_database. Internally this also renames the parameter "force" to disconnect. This was the only use-case for the parameter before, so repurposing it to this mroe narrow usecase makes things cleaner than inventing something new. Author: Laurenz Albe Reviewed-By: Magnus Hagander, Soumyadeep Chakraborty, Masahiro Ikeda Discussion: https://postgr.es/m/b07e1f9953701b90c66ed368656f2aef40cac4fb.camel@cybertec.at Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/960869da0803427d14335bba24393f414b476e2c Modified Files -------------- doc/src/sgml/monitoring.sgml | 77 ++++++++++++++++++++ src/backend/catalog/system_views.sql | 7 ++ src/backend/postmaster/pgstat.c | 134 +++++++++++++++++++++++++++++++++-- src/backend/tcop/postgres.c | 11 ++- src/backend/utils/adt/pgstatfuncs.c | 94 ++++++++++++++++++++++++ src/backend/utils/error/elog.c | 8 +++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 32 +++++++++ src/include/pgstat.h | 39 ++++++++++ src/test/regress/expected/rules.out | 7 ++ 10 files changed, 405 insertions(+), 6 deletions(-)
On Mon, Jan 18, 2021 at 5:09 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote: > > On Sun, 2021-01-17 at 13:07 +0000, Magnus Hagander wrote: > > Add pg_stat_database counters for sessions and session time > > > > This add counters for number of sessions, the different kind of session > > termination types, and timers for how much time is spent in active vs > > idle in a database to pg_stat_database. > > Should't this update PGSTAT_FILE_FORMAT_ID in include/pgstat.h > since "struct PgStat_StatDBEntry" was changed? Per my reply in the other thread -- yes it should. Fixed. -- Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/