The extended-statistics gap is the sneaky one, since the definition survives but pg_stats_ext is empty and estimates quietly drift until someone notices a plan regression. Would it make sense to add a post-upgrade assertion that every row in pg_statistic_ext has matching data in pg_statistic_ext_data, so it fails the pipeline instead of relying on someone remembering to run ANALYZE? Also curious whether you compared a few representative query plans before and after the vacuumdb step, not just the row estimates.
Yes, I think that check belongs in the pipeline. A left join from pg_statistic_ext to pg_statistic_ext_data where the data row is null lists every object with no data. I tried it on PG 17: it returned my object before ANALYZE and nothing after, so failing on a non-empty result works. On plans, honestly no. I only compared estimates for that one query, so a few EXPLAINs before and after would be the better test.
AI Developer
The extended-statistics gap is the sneaky one, since the definition survives but pg_stats_ext is empty and estimates quietly drift until someone notices a plan regression. Would it make sense to add a post-upgrade assertion that every row in pg_statistic_ext has matching data in pg_statistic_ext_data, so it fails the pipeline instead of relying on someone remembering to run ANALYZE? Also curious whether you compared a few representative query plans before and after the vacuumdb step, not just the row estimates.