Don Seiler wrote: > On Mon, Dec 4, 2017 at 3:37 PM, Adrien Nayrat <adrien.nayrat@xxxxxxxxxx> > wrote: > > > > Stats are deleted after promotion : > > " The stats file is deleted at the start of recovery, so stats from > > primary and > > standby will differ; this is considered a feature, not a bug." > > https://www.postgresql.org/docs/current/static/hot-standby.html > OK good to know. Interesting point but I think I disagree about the standby > having its own stats. Until replication is broken, wouldn't the data be > identical to the primary, and so the statistics should be identical as well? Those stats aren't part of regular data, so no they shouldn't. The docs are telling half the truth when they say this is a not-bug-but-feature, though. It's true that we don't want to overwrite some of these counters, such as number of scans, number of tuples accessed, etc; but ideally we should keep things such as vacuum/analyze counts and last times, and also the counts of dead/live/ mod_since_analyze tuples, to keep autovacuum informed without requiring an ANALYZE. This seems pretty difficult to implement, though; as far as I know we haven't even discussed it. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services