RE: analyze-in-stages post upgrade questions

Zechman, Derek S <derek.s.zechman@snapon.com>

From: "Zechman, Derek S" <Derek.S.Zechman@snapon.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>, Adrian Klaver <adrian.klaver@aklaver.com>, "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2025-07-09T11:30:22Z
Lists: pgsql-hackers, pgsql-general
> > Well, that wouldn't explain why it doesn't work on partitioned tables.

> > I am under the impression that it should.

> >

> > Derek, can cou share the pg_stats entries for the partitioned table?

>

> There are no entries in pg_stats for the parent table until after I manually run an analyze on it – Example below



You are right.  I looked at the code, and "vacuumdb" does not process

partitiond tables, even if --analyze-only is specified.  I find that

surprising, aince the SQL command ANALYZE (without a table name) will

also collect statistics for partitioned tables.



I think that it would be a good idea to change that behavior.

In particular, it makes a lot of sense to collect statistics for

partitioned tables after a "pg_upgrade".



Attached is a patch to make "vacuumdb --analyze-only" consider

partitioned tables as well.



Yours,

Laurenz Albe



Is there a plan to include this patch in future releases/patches of postgres?



Thanks,

(Derek) Sean

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. vacuumdb: Make vacuumdb --analyze-only process partitioned tables.

  2. Integrate FullTransactionIds deeper into two-phase code