Fix double-counting of pending relation stats by VACUUM and ANALYZE

Edit
ID 7460
Title Fix double-counting of pending relation stats by VACUUM and ANALYZE
CI (CFBot) Summary
Stats (from CFBot) Patch version: v2, Patch count: 2, First patch: +138−6, All patches: +149−7
Tags Bugfix
Created 2026-10-15 07:58:07
Last modified 2026-10-15 07:58:07 (1 hour ago)
Latest email 2026-10-15 08:05:52 (1 hour ago)
Status
PG20-3 (2026-11-01 – 2026-11-30): Needs review
Target version
Authors Manuel Reyes Bravo (manu15), Ilya Staroverov (ilyastar)
Reviewers Become reviewer
Committer
Links
Emails
VACUUM/ANALYZE double-count the backend's own pending table stats (n_live_tup = 2*N after INSERT + ANALYZE)
First at 2026-10-14 10:39:50 by Staroverov Ilja <i.staroverov at ftdata.ru>
Latest at 2026-10-15 08:05:52 by Staroverov Ilja <i.staroverov at ftdata.ru>
Latest attachment (v2-0001-Fix-double-counting-of-pending-relation-stats-by-.patch) at 2026-10-15 08:05:52 from Staroverov Ilja <i.staroverov at ftdata.ru>
    Attachment (v2-0001-Fix-double-counting-of-pending-relation-stats-by-.patch) at 2026-10-15 08:05:52 from Staroverov Ilja <i.staroverov at ftdata.ru> (Patch: Pending check)
    Attachment (p1_repro.sql.txt) at 2026-10-15 07:11:27 from Manu <manuelreyesbravo at gmail.com> (Patch: No)
    Attachment (v2-0001-Fix-double-counting-of-pending-relation-stats-by-.patch) at 2026-10-15 06:08:19 from Staroverov Ilja <i.staroverov at ftdata.ru> (Patch: No)
    Attachment (pending-stats-autovacuum.sh) at 2026-10-14 20:28:17 from Sebastian Webber <sebastian at swebber.me> (Patch: No)
    Attachment (ins-since-vacuum.diff) at 2026-10-14 18:47:04 from Manu <manuelreyesbravo at gmail.com> (Patch: Yes)
    Attachment (v1-0001-Fix-double-counting-of-pending-relation-stats-by-.patch) at 2026-10-14 10:39:50 from Staroverov Ilja <i.staroverov at ftdata.ru> (Patch: No)
History
When Who What
2026-10-15 09:02:33 CFbot Patch does not need rebase anymore
2026-10-15 08:04:35 CFbot Patch needs rebase
2026-10-15 07:58:07 Ilya Staroverov (ilyastar) Attached mail thread 1DC9D815-8754-4A76-B2B1-99C1A614A55A@localhost.localdomain
2026-10-15 07:58:07 Ilya Staroverov (ilyastar) Created patch record
Edit