model-writtenrun 5676 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andrei Zubkov proposed aggregating regular and TOAST index statistics through a shared CTE in #1, fixing duplicate pg_statio_all_tables rows when multiple TOAST indexes exist, a problem reported by Sergey Grinko.
- Michael Paquier confirmed the behavior and questioned counting invalid indexes in #2; Andrei defended including them because they still consume resources in #3, and subsequently noted that the change required a catalog version bump in #4.
- Tom Lane agreed to include invalid indexes and fixed the mistaken TOAST hit-counter expression in #5, but identified that the shared CTE computes all index statistics even for filtered queries; simply summing both joined index sets would instead multiply the counts.
- Tom replaced the CTE with separate LEFT JOIN LATERAL aggregations in #6, preserving efficient filtered access while acknowledging that fetching most or all rows might be less efficient.
- Tom committed #6 as ce95c54376, adding only the catalog version bump, and announced the landing in #7; the commit explicitly declined back-patching because changing system views in stable branches is difficult.
- After the landing, Andrei raised concerns about monitoring tools sampling the entire view and suggested alternatives in #8; Tom replied in #9 that further changes needed evidence of a meaningful performance regression, leaving the fix landed with no additional patch proposed.