Re: vacuumdb changes for stats import/export

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, John Naylor <johncnaylorls(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: vacuumdb changes for stats import/export
Date: 2025-07-26 14:22:49
Message-ID: aITkuWC4Ww88GsFL@momjian.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 23, 2025 at 02:45:10PM +0200, Frédéric Yhuel wrote:
>
>
> On 3/18/25 22:37, Nathan Bossart wrote:
> > Committed with the following small changes:
>
> Hi, I don't really understand this sentence in
> doc/src/sgml/ref/vacuumdb.sgml:
>
> > This option prevents vacuumdb from deleting existing statistics so that
> the query optimizer's choices do not become transiently worse.
>
> I thought that the point was to avoid unnecessary post-upgrade analyzes?

So, the full paragraph is:

+ Only analyze relations that are missing statistics for a column, index
+ expression, or extended statistics object. This option prevents
+ <application>vacuumdb</application> from deleting existing statistics
+ so that the query optimizer's choices do not become transiently worse.

What it is trying to say is that if you run vacuumedb without this
option, not only will it analyze all tables, including ones that already
have statistics, but will drop statistics on this tables that already
have statistics for a brief period while it installs new statistics.
During that period, the optimizer will not have any statistics for the
table. Is there a clearer way to state this?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-07-26 14:47:47 Re: vacuumdb changes for stats import/export
Previous Message Konstantin Knizhnik 2025-07-26 13:27:23 Re: Logical replication prefetch