| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Chengpeng Yan <chengpeng_yan(at)outlook(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jeff Davis <pgsql(at)j-davis(dot)com> |
| Subject: | Re: [PATCH] Fix encoding-dependent LIKE/regex selectivity estimates |
| Date: | 2026-11-20 20:06:20 |
| Message-ID: | 1702433.1795205180@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Chengpeng Yan <chengpeng_yan(at)outlook(dot)com> writes:
> On Nov 20, 2026, at 02:45, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-11-20 20:13:22 | more cleanup for s_lock.h |
| Previous Message | Álvaro Herrera | 2026-11-20 20:04:19 | Re: Table AM callback for logical decoding support (REPACK CONCURRENTLY) |