Hi,

On Wed, Oct 22, 2025 at 02:51:31PM +0900, Michael Paquier wrote:
> 
> A first part here is something that Bertrand Drouvot has been working
> on: being able to rebuild the table stats during WAL replay requires
> us to move the stats to be relfilenode-based, so as the startup could
> know where to recreate some of the numbers lost during crash recovery
> from WAL, giving autovacuum a safety net.

Yeah, I resumed working on it recently and should be able to share a patch
next week (based on what we discussed in [1]).

Next week patch will be the first step i.e replace (i.e get rid) 
PGSTAT_KIND_RELATION
by a brand new PGSTAT_KIND_RELFILENODE and move all the existing stats that are
currently under the PGSTAT_KIND_RELATION to this new PGSTAT_KIND_RELFILENODE.

It will do this by keeping the pg_stat_all_tables|indexes and 
pg_statio_all_tables|indexes
on top of the PGSTAT_KIND_RELFILENODE and ensure that a relation rewrite keeps 
those stats.

Next step will be that, once done, we could work from there to add new stats 
(add
writes counters (heap_blks_written and friends) and ensure that some counters
(n_dead_tup and friends) are replicated).

[1]: 
https://www.postgresql.org/message-id/aN07p71KNFR2HdaD%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to