model-writtenrun 8449 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Vaibhav Jain reported that on-access visibility-map setting could make VACUUM scan an unrepresentative tail and produce zero, declining, or stale tuple estimates; #1 proposed excluding uninitialized pages, retaining unknown estimates for tiny samples, scaling prior density after relation growth, and preserving cumulative live-tuple statistics.
- In #2, Melanie Plageman agreed that the failures warranted fixes and supported returning reltuples = -1: forcing a full scan would sacrifice on-access visibility-map savings, while using cumulative statistics would introduce an unsuitable dependency.
- Melanie's revision in #2 split the preliminary estimation fixes from uninitialized-page accounting, added an ABI-compatible extended-function wrapper for PostgreSQL 19, and revised the tests; she planned a direct API change on master and suggested marking new pages in the visibility map as future work.
- 49931d8fdc extracted the statistics-preservation changes from both patches in #2, passing unknown estimates through to pgstat and adding an assertion before preserving the existing live-tuple count.
- 1a001d930e extracted the tiny-sample unknown-density guard from #2, together with an adjusted explanatory comment in vacuumlazy.c.
- eacabd7d03 separately extracted the relation-size guard from #2, allowing prior density to scale estimates after growth or shrinkage instead of retaining a stale absolute count.
- In #3, Melanie confirmed that the preliminary fixes had landed on master and PostgreSQL 19 and posted the remaining uninitialized-page accounting patch with a direct API change, asking the release management team whether that signature change could also go into PostgreSQL 19 before its GA freeze.
- Zsolt Parragi reported in #4 that pgstattuple_approx() exposed -1 despite code intended to clamp unknown counts to zero; Melanie explained in #5 that assigning the estimate to an unsigned counter before clamping caused the preexisting bug and proposed clamping a double first.
- Fujii Masao demonstrated in #6 that an emptied and repopulated table could retain a zero estimate and suggested treating old_rel_tuples = 0 as unknown; Melanie explained in #9 that this behavior predated the fixes and that the proposed condition would yield an unknown estimate rather than supply enough data for a new count, so it was not incorporated.
- Zsolt identified a stale negative-return comment in #7, and Melanie agreed in #8 to remove it when committing the remaining VACUUM patch; she also reproduced the pgstattuple conversion bug on older releases and favored restoring the intended zero result on stable branches while considering NULL or -1 consistently across relevant fields on master.
- 206e71935e landed the remaining patch from #3, including the direct API change and regression tests, with only the stale comment removed and the commit description revised; it credits Melanie and Vaibhav as co-authors and has a PostgreSQL 19 backport.
- In #10, Melanie confirmed that the original series had landed and proposed a separate pgstattuple fix that clamps before unsigned conversion, tests the unknown-count case, and documents zero as the result, targeting backpatches through PostgreSQL 15; she held it for agreement on behavior and documentation despite the approaching PostgreSQL 19 freeze.
- Lukas Fittl approved the pgstattuple patch and documentation in #11, while favoring NULL for future releases and explaining its compatibility risk for existing clients, and Zsolt approved it in #12, comparing its handling with the existing clamp in vacuumlazy.c.
- In #13, Melanie said the pgstattuple fix had missed the PostgreSQL 19 freeze and would wait for the next minor releases; she favored a subsequent master-only change to NULL so its compatibility impact could be assessed before release.
- Melanie confirmed the clamp fix and its backpatches in #14; 8c15c2cb5c landed #10 unchanged, with backpatches through PostgreSQL 15.
- Lukas reiterated in #15 that NULL would remove the ambiguity between unknown and empty counts on master, and Melanie posted the follow-up in #16, adding an unknown-count flag and updating the SQL result, regression expectation and documentation.
- b443bc7406 landed #16 unchanged on master, and Melanie confirmed completion in #17; the original VACUUM series and both pgstattuple follow-ups are complete, with stable branches returning zero for unknown counts and master returning NULL.