Re: Proposal: ANALYZE (MODIFIED_STATS) using autoanalyze thresholds

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, VASUKI M <vasukianand0119(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Sami Imseih <samimseih(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, Christoph Berg <myon(at)debian(dot)org>, Andreas Karlsson <andreas(at)proxel(dot)se>
Subject: Re: Proposal: ANALYZE (MODIFIED_STATS) using autoanalyze thresholds
Date: 2026-02-24 16:27:25
Message-ID: aZ3RbTE8Racscykc@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 24, 2026 at 08:45:26AM -0500, Corey Huinker wrote:
> 1. The view would need to expose pg_class.oid so that it could be joined to
> the listed_object CTE. Our pattern seems to be schemaname+tablename with no
> exposed oids, something that has caused a problem in the past, namely in
> pg_dump when batching attribute stats. Is exposing oids in these views a
> no-no?

I don't think so. Counterexamples include pg_stat_activity,
pg_stat_subscription, pg_stat_database, pg_stat_all_tables, and more. If
anything, maybe we should consider _adding_ oid columns to views like
pg_stats_ext...

> 2. The view either needs the pg_class.oid to join back to pg_class to get
> relkind, relpersistence, relfrozenxid, relminmxid, etc...or it needs to
> expose those columns as a part of the view, which would be problematic when
> vacuumdb and other apps decide that they need to filter on some other part
> of pg_class, and then we've got different versions of the system view which
> makes that option highly unattractive.

Hm. I don't know how much to worry about this. System view/catalog
changes do happen from time to time, so unless we have a bunch of possible
changes that will happen soon, I'd expect it to probably be okay.

> If we instead did a system function `pg_rel_is_missing_stats(oid) returns
> boolean`, but it would still need to sanity check on relkind and filter on
> relpersistence and inherited.

Couldn't the function handle those sanity checks?

--
nathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-02-24 16:32:43 Re: Flush some statistics within running transactions
Previous Message Tom Lane 2026-02-24 16:24:45 Warning-suppression fixes we ought to back-patch