On Mon, Dec 4, 2017 at 4:02 PM, Alvaro Herrera <alvherre@xxxxxxxxxxxxxx> wrote:
Those stats aren't part of regular data, so no they shouldn't.
I would consider object statistics to be part of a database, and a very important part at that.
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.
I'm not so worried about the time of last vacuum or analyze but the statistics for optimizer usage would be necessary. Otherwise I would think the time to complete a failover would have to include that "vacuumdb --all --analyze-only" run as queries run before that could be very out-of-sorts with no information on the data. Although perhaps I'm misunderstanding where the optimizer gets its information from and these pg_stat_% tables are not what I seem to think they are.
Anyway, sounds like you've all been over this one before. I'll just make a note of it for my own reference for now.
Don.
Don Seiler
www.seiler.us
www.seiler.us