Chengpeng Yan <[email protected]> writes:
> On Nov 20, 2026, at 02:45, Tom Lane <[email protected]> wrote:
>> So TBH I'm wondering if this code is worth putting a lot of effort
>> into, as opposed to just nuking it all from orbit and using some
>> default number when we lack any histogram. Did your interest in it
>> stem from any bad real-world experience, and if so what did that
>> use-case look like?
> You are right that it is rarely reached, so it does not seem worth
> continuing to optimize. Looking for what could replace it, I noticed
> that generic_restriction_selectivity() does very nearly the same job:
> apply the operator to the MCV and histogram samples, and fall back on a
> default when there is little data. It is already used for a number of
> other operators.
It is nearly the same logic, but I'm not sure you can easily use that
in combination with the fixed-prefix logic in patternsel_common,
which we should certainly not give up. I'd be inclined to approach
this by just replacing "rest_selec" with a constant and removing all
the subsidiary code that calculates that.
regards, tom lane