| From: | Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | nathandbossart(at)gmail(dot)com |
| Subject: | Fix --missing-stats-only false positive for partitioned expression indexes |
| Date: | 2026-06-16 15:25:52 |
| Message-ID: | CA+fm-RPE1tEc6CUUPDyRbYTz9tF5Kw47nnk-Zq=yYvanbsxyCQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-vacuumdb-missing-stats-only-false-positive-for-p.patch | application/octet-stream | 2.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-06-16 15:31:47 | Re: Direction for test frameworks: Perl TAP vs. Python/pytest |
| Previous Message | Melanie Plageman | 2026-06-16 15:24:29 | Re: Direction for test frameworks: Perl TAP vs. Python/pytest |