Re: shared-memory based stats collector - v70

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
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-08 04:39:55
Message-ID: CAKFQuwYUkqK77UT+KruKOv7OK7_0X34ihmxLBmW8qG9NQQGmwg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

>
> <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:

... 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.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-04-08 04:40:55 Re: Windows now has fdatasync()
Previous Message Andres Freund 2022-04-08 04:38:04 Re: shared-memory based stats collector - v70