Re: analyze-in-stages post upgrade questions

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: "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-06-27 13:41:39
Message-ID: CANzqJaCC8QT8yugqF8vM_5Rs1eiTy9iWbQ=Ty8Bre93u7rh_FQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 27, 2025 at 9:35 AM Zechman, Derek S <Derek(dot)S(dot)Zechman(at)snapon(dot)com>
wrote:

>
>
> We recently performed an upgrade from pg14 (14.18) to pg16 (16.9) and
> performed the analyze-in-stages post upgrade. It has been noticed that
> some plans changed to use hash joins instead of nested loops. Further
> investigation found it was because the parent table of partitioned tables
> did not have stats. After running an ANALYZE on the parent tables we got
> similar plan an execution times as before.
>
>
>
> I have two questions
>
> 1 - Why does analyze-in-stages not analyze the parent tables?
>
> 2 – What happens if we do not run analyze-in-stages post upgrade and just
> run an analyze?
>

It takes more time, and you don't have *any* statistics on a given table
until the ANALYZE on that table completes.

How long did "vacuumdb --analyze-only --jobs=$mumble your_db" take?

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Giacomo Cavalieri 2025-06-27 14:30:41 Figure out nullability of query parameters
Previous Message Zechman, Derek S 2025-06-27 13:35:27 analyze-in-stages post upgrade questions