model-writtenrun 6939 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Mar - Apr 2026 ยท 23 entries
- Sami Imseih proposed a per-table autovacuum priority view exposing component scores, overall priority, and vacuum/analyze need, initially using a force_scores parameter to support inspection outside autovacuum workers #1.
- Satyanarayana Narlapuram tested the initial series and questioned filtering, permissions, interrupt handling, and standby behavior, while Bharath Rupireddy proposed per-table access and restricted execution privileges #2 #3 #4.
- After Robert Treat raised the needs of users with MAINTAIN privileges, Sami chose pg_read_all_stats access and a full-database scan, arguing that comparing table priorities was the primary use case; the revised tests disabled autovacuum for stability #7 #9 #11.
- Alvaro Herrera identified duplicated statistics-fetch and scoring calls, prompting Sami to introduce a shared compute_autovac_score() helper as a separate prerequisite #8 #12.
- Nathan Bossart argued that the scoring routine should always calculate scores, including transaction-age scores below eligibility thresholds, rather than require a special force flag; Sami adopted that design and separated logging control into an elevel parameter #13 #15 #16 #19.
- Subsequent revisions removed unnecessary renaming, corrected logging suppression and threshold-score calculations, and repaired an independently applied prerequisite; Sami declined automatic sorting of the view #20 #21 #22 #24.
- Nathan took over commit preparation, added an early-return refactoring, removed separate need booleans and dedicated vacuum tests, and temporarily renamed the view pg_autovacuum_scores; he retained historical analyze behavior during forced vacuum and deferred a per-table interface #25.
- The early-return prerequisite landed unchanged as 8261ee24fe, the score-computation component landed with threshold-logic corrections as 53b8ca6881, and the elevel component landed unchanged as 01876ace13, all from #25.
- Sami advocated keeping the view near existing statistics views, and Nathan's remaining series restored pg_stat_autovacuum_scores, opened access to all users, and moved statistics fetching directly into relation_needs_vacanalyze() instead of retaining a wrapper #26 #27.
- Sami supplied a documentation fix explaining that configurable weights invalidate a universal score threshold of 1.0; Nathan instead revised the documentation to describe weight-dependent thresholds #28 #31.
- Sami then proposed independent needs_vacuum and needs_analyze flags, but Nathan countered with the existing autovacuum decision booleans so the view would reflect actual eligibility; Sami accepted that approach #32 #33 #34.
- The remaining wrapper-removal prerequisite from #33 landed with small cleanup edits as 775fe51daa.
- The view and boolean extension from #33 landed together as 87f61f0c82, with do_vacuum/do_analyze names, clarified snapshot limitations, stable/parallel-restricted function declarations, and a catalog-version bump; Nathan announced completion in #35.
- Alexander Lakhin reported a SQLsmith-discovered double-free when the view was invoked twice in one statement, and Tom Lane pointed to Tender Wang's earlier report and proposed fix in thread #139248 #36 #37.
- Sami's initial repair freed statistics entries only under fetch-consistency mode NONE, while Nathan proposed restricting explicit freeing to autovacuum workers; both approaches exposed the lack of a clear ownership contract #39 #40 #42.
- Andres Freund and Tom Lane recommended an explicit ownership output parameter in the statistics API, replacing reliance on caller identity or knowledge of the fetch-consistency setting #43 #44.
- Tom also objected to using an undocumented literal zero to suppress logging, and Nathan attached the separate LOG_NEVER cleanup #46 #49.
- A parallel memory investigation showed that persistent shared-statistics references behaved like those used by pg_stat_all_tables; Andres explained their contention benefits and discussed slab allocation as a possible separate improvement, and Nathan acknowledged that his original comparison used count(*) #50 #52 #53 #54 #56.
- Sami abandoned a proposed no-cache API and implemented the ownership output parameter across the statistics-fetch interfaces, leaving other possible freeing opportunities outside this fix #51 #55.
- The LOG_NEVER attachment from #49 landed unchanged as 60165db6e1, announced in #58.
- Nathan renamed the ownership output to may_free and tied its true value to the actual uncached allocation in the staged patch #59; that patch landed with comment-only edits as 71ff232a5b.
- Although thread #139248 supplied an earlier report and conditional-free proposal, this thread supplied the latest matching patch and final ownership-API implementation for 71ff232a5b, with Sami credited as author and Tender and Alexander as reporters.
- The final message confirms the double-free fix was committed, completing all attached feature and repair work; broader cache-memory improvements and optional cleanup of other statistics callers remained outside the landed series #60 #61.