Peter Geoghegan <p...@bowt.ie> writes: > On Tue, Aug 8, 2023 at 8:43 PM Justin Pryzby <pry...@telsasoft.com> wrote: >> The problem isn't that reltuples == -1 after the upgrade (which is >> normal). The issue is that if VACUUM skips all the pages, it can leave >> reltuples -1. My expectation is that after running "vacuum", no tables >> are left in the "never have been vacuumed" state.
> But -1 isn't the "never have been vacuumed" state, exactly. At best it > is the "never been vacuumed or analyzed" state. Yeah. -1 effectively pleads ignorance about the number of live tuples. If VACUUM has skipped every page, then it is still ignorant about the true number of live tuples, so setting the value to something else would be inappropriate. Perhaps, though, there's a case for forcing all pages to be visited if we start with reltuples == -1? I'm not sure it matters much though given that you also need an ANALYZE run to be really in a good place after pg_upgrade. The ANALYZE should update this. regards, tom lane