RE: analyze-in-stages post upgrade questions

From: "Zechman, Derek S" <Derek(dot)S(dot)Zechman(at)snapon(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: analyze-in-stages post upgrade questions
Date: 2025-07-09 11:30:22
Message-ID: PH0PR04MB8294E796D6297D4E3BE4EFB6C049A@PH0PR04MB8294.namprd04.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> > 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alpaslan AKDAĞ 2025-07-09 13:56:58 Password Encryption and Connection Issues
Previous Message Shlok Kyal 2025-07-09 08:27:42 Re: error “server process was terminated by signal 11: Segmentation fault” running pg_create_logical_replication_slot using pgoutput plugin

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2025-07-09 11:36:37 Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions
Previous Message Florents Tselai 2025-07-09 11:27:22 Re: like pg_shmem_allocations, but fine-grained for DSM registry ?