From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: statistics for shared catalogs not updated when autovacuum is off
Date: Mon, 1 Feb 2016 19:38:32 -0600
Message-ID: <56B00898.4010409@BlueTreble.com> (raw)
In-Reply-To: <56B0044C.1030001@gmx.net>
References: <56AD41AC.1030509@gmx.net>
<56AF7093.7070804@BlueTreble.com>
<56B0044C.1030001@gmx.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 2/1/16 7:20 PM, Peter Eisentraut wrote:
> That's probably right. Even with autovacuum on, the statistics for
> shared catalogs do not appear as updated right away. That is, if you
> run VACUUM and then look at pg_stat_sys_tables right away, you will see
> the stats for shared catalogs to be slightly out of date until the
> minutely autovacuum check causes them to update.
>
> So the problem exists in general, but the autovacuum launcher papers
> over it every minute.
I suspect the issue is in backend_read_statsfile(). Presumably the if
just needs a call to AutoVacuumingActive() added:
> /*
> * Autovacuum launcher wants stats about all databases, but a shallow read
> * is sufficient.
> */
> if (IsAutoVacuumLauncherProcess())
> pgStatDBHash = pgstat_read_statsfiles(InvalidOid, false, false);
> else
> pgStatDBHash = pgstat_read_statsfiles(MyDatabaseId, false, true);
The interesting thing is that we always start the launcher one time, to
protect against wraparound, but apparently that path doesn't call
anything that calls backend_read_statsfile() (which is static).
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: Jim.Nasby@BlueTreble.com, peter_e@gmx.net
Subject: Re: statistics for shared catalogs not updated when autovacuum is off
In-Reply-To: <56B00898.4010409@BlueTreble.com>
References: <56AD41AC.1030509@gmx.net> <56AF7093.7070804@BlueTreble.com> <56B0044C.1030001@gmx.net> <56B00898.4010409@BlueTreble.com>
* 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