Re: vacuumdb --missing-stats-only and pg_upgrade from PG13

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: Nathan Bossart <nathan(at)postgresql(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Date: 2025-04-23 14:33:17
Message-ID: aAj6LaoBqrSshnPd@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Apr 23, 2025 at 04:01:33PM +0200, Christoph Berg wrote:
> If I create a table in a PG13-or-earlier cluster, never ANALYZE it,
> and then pg_upgrade to 18 and run vacuumdb --analyze-only
> --missing-stats-only, the table will not get analyzed. The only table
> visited there is pg_largeobject.

I suspect this is due to commit 3d351d9, which started using -1 for
reltuples before the first vacuum/analyze. Before that, we set it to 0,
which could also mean the table is empty. --missing-stats-only checks for
reltuples != 0.

My first reaction is that we should just remove the reltuples != 0 check.
That means vacuumdb might analyze some empty tables, but that doesn't seem
too terrible.

--
nathan

Attachment Content-Type Size
fix_missing_stats_only.patch text/plain 2.6 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Christoph Berg 2025-04-23 14:38:16 Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Previous Message Christoph Berg 2025-04-23 14:10:56 Re: pgsql: Update guidance for running vacuumdb after pg_upgrade.

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-04-23 14:38:16 Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Previous Message Christoph Berg 2025-04-23 14:10:56 Re: pgsql: Update guidance for running vacuumdb after pg_upgrade.