Re: vacuumdb changes for stats import/export

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>, Jeff Davis <pgsql@j-davis.com>, Corey Huinker <corey.huinker@gmail.com>, jian he <jian.universality@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Magnus Hagander <magnus@hagander.net>, Stephen Frost <sfrost@snowman.net>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Peter Smith <smithpb2250@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, alvherre@alvh.no-ip.org
Date: 2025-02-04T21:43:57Z
Lists: pgsql-hackers

Attachments

I had the opportunity to bring this patch set up for discussion at the
developer meeting at FOSDEM PGDay last week [0].  There seemed to be a
strong consensus that the idea of a "missing only" mode for vacuumdb's
analyze options was useful (especially so if the extended stats piece of
the stats import/export project doesn't make it into v18), but that we
shouldn't change the default behavior of the existing options.  Given that,
I have modified the patch set to instead introduce a --missing-only option
that can be used in conjuction with --analyze-only and --analyze-in-stages.
The underlying implementation is the same as in v1 of the patch set, except
for the following changes:

* I've modified the extended stats part of the query to also check for
  pg_statistic_ext.stxstattarget IS DISTINCT FROM 0.

* I've added a new clause to check for extended statistics on tables with
  inheritance children, i.e., those with pg_statistic_ext_data.stxdinherit
  set to true.

* I've added a server version check that disallows --missing-only on
  servers older than v15.  The catalog query would need some adjustments to
  work on older versions, but that didn't seem critically important.  We
  could always revisit this in the future.

[0] https://2025.fosdempgday.org/devmeeting

-- 
nathan

Commits

  1. doc: Adjust documentation for vacuumdb --missing-stats-only.

  2. Update guidance for running vacuumdb after pg_upgrade.

  3. vacuumdb: Add option for analyzing only relations missing stats.

  4. vacuumdb: Teach vacuum_one_database() to reuse query results.