Re: Add session statistics to pg_stat_database

Magnus Hagander <magnus@hagander.net>

From: Magnus Hagander <magnus@hagander.net>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Masahiro Ikeda <ikedamsh@oss.nttdata.com>, Ahsan Hadi <ahsan.hadi@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, Soumyadeep Chakraborty <soumyadeep2007@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-01-18T16:52:47Z
Lists: pgsql-hackers
On Mon, Jan 18, 2021 at 5:11 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Sun, 2021-01-17 at 14:07 +0100, Magnus Hagander wrote:
> > I have applied this version, with some minor changes:
> >
> > * I renamed the n_<x>_time members in the struct to just
> > total_<x>_time. The n_ indicates "number of" and is thus wrong for
> > time parameters.
>
> Right.
>
> > * Some very minor wording changes.
> >
> > * catversion bump (for once I didn't forget it!)
>
> Thank you!
>
> You included the catversion bump, but shouldn't PGSTAT_FILE_FORMAT_ID
> in "include/pgstat.h" be updated as well?

Yup, you are absolutely correct. Will fix.

-- 
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/



Commits

  1. Bump PGSTAT_FILE_FORMAT_ID

  2. Add pg_stat_database counters for sessions and session time

  3. Fix oversight in my patch of yesterday: forgot to ensure that stats would