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.