From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Don Seiler <don@seiler.us>
Cc: Adrien Nayrat <adrien.nayrat@dalibo.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: No stats after promoting standby?
Date: Mon, 4 Dec 2017 19:36:47 -0300
Message-ID: <20171204223647.d2sim25ndz5lmqw5@alvherre.pgsql> (raw)
In-Reply-To: <CAHJZqBDTY45Fqe7DfMDCfPq3rvfRHu2OQYTgaZ8M0_EV-QOSYg@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: alvherre@2ndquadrant.com, don@seiler.us, adrien.nayrat@dalibo.com
Subject: Re: No stats after promoting standby?
In-Reply-To: <20171204223647.d2sim25ndz5lmqw5@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox