model-writtenrun 1599 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Sergei Glukhov reported that removing predicate-implied quals prevented partial hash index scans and supplied a patch retaining those quals for indexes requiring scan keys, together with a regression test #1.
- David Rowley confirmed the scan-key requirement and requested clearer comments and condition handling #2, while Tom Lane proposed handling the exception earlier and raised concerns about index-scan cost estimates #3.
- Tom supplied a revised patch retaining the original quals only when predicate filtering removed every qual, and demonstrated unexpectedly higher estimated costs for a partial hash index #4.
- Sergei and David independently showed that Tom's revision still failed when unrelated, non-indexable quals survived filtering; Sergei also traced the cost difference to page estimates and the indexes' minimum size #5 #6.
- Tom replaced that fallback with an early exemption from qual filtering for all !amoptionalkey indexes #7; David approved it and supported backpatching #8, while Tom explicitly deferred cost-estimation changes because the example concentrated every entry in one hash bucket and offered little justification for additional complexity #9.
- Sergei verified the fix and confirmed that the issue had been reported on PostgreSQL 16 #10, leading Tom to commit to backpatching in the thread's last message #11.
- The subsequent commit 9e77323fcc landed the exact planner change from #7 with added regression tests using existing fixtures, and the fix was backpatched through PostgreSQL 14; cost-estimation improvements remained deferred.