Re: No stats after promoting standby?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Don Seiler <don(at)seiler(dot)us>
Cc: Adrien Nayrat <adrien(dot)nayrat(at)dalibo(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: No stats after promoting standby?
Date: 2017-12-04 22:36:47
Message-ID: 20171204223647.d2sim25ndz5lmqw5@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Don Seiler wrote:
> On Mon, Dec 4, 2017 at 4:02 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Don Seiler 2017-12-04 22:49:31 Re: No stats after promoting standby?
Previous Message Don Seiler 2017-12-04 22:11:23 Re: No stats after promoting standby?