Fix --missing-stats-only false positive for partitioned expression indexes
Baji Shaik <baji.pgdev@gmail.com>
From: Baji Shaik <baji.pgdev@gmail.com>
To: PostgreSQL-development <pgsql-hackers@lists.postgresql.org>
Cc: nathandbossart@gmail.com
Date: 2026-06-16T15:25:52Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-vacuumdb-missing-stats-only-false-positive-for-p.patch (application/octet-stream) patch 0001
Hi, I tested "vacuumdb --missing-stats-only" and found that it flags partitioned tables that have expression indexes, even after a full ANALYZE. Steps to reproduce: CREATE TABLE parent (a int, b int) PARTITION BY RANGE (a); CREATE TABLE child1 PARTITION OF parent FOR VALUES FROM (1) TO (100); CREATE TABLE child2 PARTITION OF parent FOR VALUES FROM (100) TO (200); CREATE INDEX ON parent ((a + b)); INSERT INTO parent SELECT i, i FROM generate_series(1, 199) i; ANALYZE; $ vacuumdb --missing-stats-only --analyze-only -v postgres 2>&1 | grep "public\." INFO: analyzing "public.parent" inheritance tree -- should not appear INFO: analyzing "public.child1" -- should not appear INFO: analyzing "public.child2" -- should not appear Running ANALYZE again doesn't help. The table is always flagged. This is because expression index stats check looks for stainherit=true rows on the partitioned index, but those never exist (only leaf indexes get stats). Fix is one line to skip the check when p.inherited is true. Patch attached. Thanks, Baji Shaik.
Commits
-
vacuumdb: Fix --missing-stats-only for partitioned indexes.
- d2cea63065b3 19 (unreleased) landed
- 7e085aabd575 18 (unreleased) landed