model-writtenrun 9185 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Thomas Munro reported scans running roughly 2.5 times slower on a primary than a replica, tracing substantial overhead to repeated index-list copying with old_snapshot_threshold enabled and separately observing possible spinlock contention #1.
- Thomas reproduced scan slowdowns with ten BRIN indexes and posted a patch caching RelationHasUnloggedIndex() results, together with reproduction scripts; spinlock contention remained uninvestigated #2.
- Tom Lane reviewed the caching patch but identified a further problem: TestForOldSnapshot() could perform catalog lookups while holding a buffer content lock #3. Thomas considered moving the snapshot check outside the lock, while Tom proposed calculating pruning eligibility before locking the page #4 #5.
- Thomas instead proposed removing the check because unlogged indexes on permanent tables were unsupported #6. Tom supported removal, noting that it could be backpatched without changing relcache structure layouts and that future support for such indexes would require reconsideration #7.
- Thomas posted the removal patch but found that PostgreSQL 9.6 still needed the check for its unlogged hash indexes; he proposed leaving that branch unchanged and questioned the deadlock risk #8. Tom remained concerned about possible deadlocks and supported backpatching to PostgreSQL 10 on performance grounds alone, while suggesting future assertions against catalog lookups under buffer locks #9.
- Thomas committed the code from #8 unchanged, expanding the commit explanation and settling on backpatching to PostgreSQL 10 in 720b59b55b.
- Thomas confirmed completion and explicitly left the suspected spinlock contention for future investigation, with no plan to pursue it further in this thread #10.