Re: shared-memory based stats collector - v70

From: Andres Freund <andres(at)anarazel(dot)de>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: shared-memory based stats collector - v70
Date: 2022-04-09 19:06:55
Message-ID: 20220409190655.uhh7krr5iehrprcn@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-04-07 21:39:55 -0700, David G. Johnston wrote:
> On Thu, Apr 7, 2022 at 8:59 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> >
> > <para>
> > Cumulative statistics are collected in shared memory. Every
> > <productname>PostgreSQL</productname> process collects statistics
> > locally
> > then updates the shared data at appropriate intervals. When a server,
> > including a physical replica, shuts down cleanly, a permanent copy of
> > the
> > statistics data is stored in the <filename>pg_stat</filename>
> > subdirectory,
> > so that statistics can be retained across server restarts. In contrast,
> > when starting from an unclean shutdown (e.g., after an immediate
> > shutdown,
> > a server crash, starting from a base backup, and point-in-time
> > recovery),
> > all statistics counters are reset.
> > </para>
> >
>
> I like this. My comment regarding using "i.e.," here stands though.

Argh. I'd used in e.g., but not i.e..

> >
> > <para>
> > The cumulative statistics system is active during recovery. All scans,
> > reads, blocks, index usage, etc., will be recorded normally on the
> > standby. However, WAL replay will not increment relation and database
> > specific counters. I.e. replay will not increment pg_stat_all_tables
> > columns (like n_tup_ins), nor will reads or writes performed by the
> > startup process be tracked in the pg_statio views, nor will associated
> > pg_stat_database columns be incremented.
> > </para>
> >
> >
> I like this too. The second part with three nors is a bit rough. Maybe:

Agreed. I tried to come up with a smoother formulation, but didn't (perhaps
because I was a tad tired).

> ... specific counters. In particular, replay will not increment
> pg_stat_database or pg_stat_all_tables columns, and the startup process
> will not report reads and writes for the pg_statio views.
>
> It would helpful to give at least one specific example of what is being
> recorded normally, especially since we give three of what is not.

The second sentence is a set of examples - or do you mean examples for what
actions by the startup process are counted?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-04-09 19:38:49 Re: shared-memory based stats collector - v70
Previous Message Jonathan S. Katz 2022-04-09 18:50:59 Re: How about a psql backslash command to show GUCs?