From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Y_Bharani_mbsv <mailbsv(at)yahoo(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Help in vetting outcome of "vacuumdb --analyze-in-stages" - during DB Upgrade from EC2- PGS - Community Edn ver 13.X to 14.X |
Date: | 2025-02-16 16:19:35 |
Message-ID: | 6f44101c-ce01-478e-9fb1-138a10f358d9@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2/16/25 05:13, Y_Bharani_mbsv wrote:
> Team
> Good Morning.
> As part of DB upgrade from EC2 - PGS - community Edn Ver 13.X to 14.X
> I followed steps of "pg_upgrade" and had executed the last step (post
> successful db migration)
>
> vacuumdb --analyze-in-stages
>
> and later noticed an caveat
> url = https://www.postgresql.org/docs/current/app-vacuumdb.html
> <https://www.postgresql.org/docs/current/app-vacuumdb.html>
>
>
> |--analyze-in-stages|
>
> Only calculate statistics for use by the optimizer (no vacuum), like
> |--analyze-only|. Run three stages of analyze; the first stage uses
> the lowest possible statistics target (see default_statistics_target
> <https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET>) to produce usable statistics faster, and subsequent stages build the full statistics.
>
> This option is only useful to analyze a database that currently has
> no statistics or has wholly incorrect ones, such as if it is newly
> populated from a restored dump or by |pg_upgrade|. *Be aware that
> running with this option in a database with existing statistics may
> cause the query optimizer choices to become transiently worse due to
> the low statistics targets of the early stages.*
Did you skip over reading this part?:
"This option is only useful to analyze a database that currently has no
statistics or has wholly incorrect ones, such as if it is newly
populated from a restored dump or by pg_upgrade."
>
>
> How to overcome the issue to avoid "transiently worse"
>
>
>
> Later, I too did
> a) vacuum(full,verbose,skip_locked) ... each table wise
> b) analyze (verbose,skip_locked) .. each table wise
> Any guidance
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2025-02-16 16:24:43 | Re: Question on Alerts |
Previous Message | Ron Johnson | 2025-02-16 14:35:41 | Re: Help in vetting outcome of "vacuumdb --analyze-in-stages" - during DB Upgrade from EC2- PGS - Community Edn ver 13.X to 14.X |