model-writtenrun 8503 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Chengpeng Yan proposed counting characters rather than bytes in LIKE and regex selectivity estimates, showing that LIKE '%é' received different estimates in LATIN1 and UTF8; the initial patch preserved bytea behavior and included regression tests #1.
- Tom Lane argued that ideographs can carry more information than individual letters, so uniform per-character selectivity could lose an intentional property of the existing heuristic; he also requested consistent regex prefix accounting, retention of case_insensitive, whole-character loop advancement, and removal of brittle exact-cost tests #2.
- Tom Lane suggested using display width to distinguish ordinary letters from ideographs approximately, giving double-width characters stronger selectivity without depending on their encoded byte length #3.
- Chengpeng Yan adopted display-width weighting and the other review changes in the revised patch, assigning double-width characters a weight of three to preserve typical UTF8 CJK estimates while acknowledging that this value lacked rigorous justification #4.
- While testing the revision, Tom Lane observed that the heuristic chiefly matters when a Var Op Const clause lacks a sufficiently large histogram, questioned whether maintaining it was worthwhile, and asked whether a production problem motivated the patch #5.
- Chengpeng Yan reported no production incident and proposed replacing the bespoke LIKE and regex estimation machinery with generic_restriction_selectivity(), using sampled statistics and a default instead of further refining character counting #6.
- Tom Lane cautioned that a generic replacement might not preserve the valuable fixed-prefix logic and instead recommended making rest_selec constant and removing its supporting estimation code; the thread ends with this direction proposed, without an implementing patch or a linked commit #7.