Re: vacuumdb --missing-stats-only and pg_upgrade from PG13
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Christoph Berg <myon@debian.org>
Cc: Nathan Bossart <nathan@postgresql.org>, Corey Huinker <corey.huinker@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-04-23T14:33:17Z
Lists: pgsql-hackers
Attachments
- fix_missing_stats_only.patch (text/plain) patch
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
Commits
-
Further adjust guidance for running vacuumdb after pg_upgrade.
- d5f1b6a75ba3 18.0 landed
-
vacuumdb: Don't skip empty relations in --missing-stats-only mode.
- 987910502420 18.0 landed
-
Update guidance for running vacuumdb after pg_upgrade.
- c9d502eb6809 18.0 cited
-
Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE.
- 3d351d916b20 14.0 cited