Hi, On 2022-04-07 20:59:21 -0700, Andres Freund 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> > ... > <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 went with these for now. My guess is that there's further improvements in them, and in surrounding areas... With that, I'll close this CF entry. It's been a while. Greetings, Andres Freund