Re: vacuumdb --missing-stats-only and pg_upgrade from PG13 - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Date
Msg-id aAj6LaoBqrSshnPd@nathan
Whole thread Raw
In response to vacuumdb --missing-stats-only and pg_upgrade from PG13  (Christoph Berg <myon@debian.org>)
Responses Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
List 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

pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: pgsql: Update guidance for running vacuumdb after pg_upgrade.
Next
From: Christoph Berg
Date:
Subject: Re: vacuumdb --missing-stats-only and pg_upgrade from PG13