public inbox for [email protected]  
help / color / mirror / Atom feed
RE: analyze-in-stages post upgrade questions
2+ messages / 2 participants
[nested] [flat]

* RE: analyze-in-stages post upgrade questions
@ 2025-07-09 11:30  Zechman, Derek S <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Zechman, Derek S @ 2025-07-09 11:30 UTC (permalink / raw)
  To: Laurenz Albe <[email protected]>; Adrian Klaver <[email protected]>; [email protected] <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: analyze-in-stages post upgrade questions
@ 2025-07-09 15:26  Laurenz Albe <[email protected]>
  parent: Zechman, Derek S <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2025-07-09 15:26 UTC (permalink / raw)
  To: Zechman, Derek S <[email protected]>; Adrian Klaver <[email protected]>; [email protected] <[email protected]>

On Wed, 2025-07-09 at 11:30 +0000, Zechman, Derek S wrote:
> > > 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.
> 
> Is there a plan to include this patch in future releases/patches of postgres? 

I have added the patch to the current commitfest:
https://commitfest.postgresql.org/patch/5871/

So far, it has not got any peer review.  So yes, I'd like to include
the patch, but I cannot make it happen by myself.
Essentially, patches get applied if
a) they get peer review and
b) a committer applies them

If you want this to happen, the best thing you could do would be
to review the patch and see if it works for you, if it does what you
need and so on:
https://wiki.postgresql.org/wiki/Reviewing_a_Patch

Yours,
Laurenz Albe






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-07-09 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-09 11:30 RE: analyze-in-stages post upgrade questions Zechman, Derek S <[email protected]>
2025-07-09 15:26 ` Laurenz Albe <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox