| From: | Tender Wang <tndrwang(at)gmail(dot)com> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Optimize IS DISTINCT FROM with non-nullable inputs |
| Date: | 2026-01-28 01:59:00 |
| Message-ID: | CAHewXN=T9am6R-qTA9T6g3+bV9i7QOgmwvd_uepFpWpW9vjx_g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Richard Guo <guofenglinux(at)gmail(dot)com> 于2026年1月27日周二 15:10写道:
>
> On Tue, Jan 27, 2026 at 11:32 AM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> > Interesting optimization. I look through the v2-0001 patch. In the
> > commit message, it says:
> > ...
> > This patch extends the optimization to cases where inputs are non-constant but
> > proven to be non-nullable. Specifically, "x IS DISTINCT FROM NULL"
> > folds to constant TRUE if "x" is known to be non-nullable.
> > ...
> >
> > But I found that the case "x IS DISTINCT FROM NULL" is converted to
> > NullTest in transformAExprDistinct().
> > It will be optimized in the "case T_NullTest:" not by this patch.
>
> Well, while it's true that the parser would do this transformation for
> "literal" NULLs, here we are talking more about "calculated" NULLs.
> Consider "not_null_col IS DISTINCT FROM (1 + NULL)".
Got it.
I looked through the v2-0002 patch. LGTM.
--
Thanks,
Tender Wang
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mihail Nikalayeu | 2026-01-28 02:06:00 | Re: Adding REPACK [concurrently] |
| Previous Message | Chao Li | 2026-01-28 01:56:36 | Re: tablecmds: reject CLUSTER ON for partitioned tables earlier |