Re: No stats after promoting standby? - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: No stats after promoting standby?
Date
Msg-id 20171204223647.d2sim25ndz5lmqw5@alvherre.pgsql
Whole thread Raw
In response to Re: No stats after promoting standby?  (Don Seiler <don@seiler.us>)
Responses Re: No stats after promoting standby?  (Don Seiler <don@seiler.us>)
List pgsql-admin
Don Seiler wrote:
> On Mon, Dec 4, 2017 at 4:02 PM, Alvaro Herrera <alvherre@alvh.no-ip.org>
> wrote:

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

The optimizer stats are not lost on crash or promote actually; these are
stored in pg_statistic (not in the stats collector) and *are* part of
regular "data".

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

I think it's pretty common misunderstanding -- it's not easy to see the
boundary between pg_statistic and pg_stat_* tables.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-admin by date:

Previous
From: Don Seiler
Date:
Subject: Re: No stats after promoting standby?
Next
From: Don Seiler
Date:
Subject: Re: No stats after promoting standby?