Re: Reduce "Var IS [NOT] NULL" quals during constant folding

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Date: 2025-03-26 06:06:11
Message-ID: CAHewXNkFfWJ22kP3OqhKW=30S+0_cjeNEzCXO03SJen8E9yFvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <guofenglinux(at)gmail(dot)com> 于2025年3月26日周三 10:16写道:

> On Sun, Mar 23, 2025 at 6:25 PM Richard Guo <guofenglinux(at)gmail(dot)com>
> wrote:
> > On Sat, Mar 22, 2025 at 2:21 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > > The way to make this work is what I said before: move the planner's
> > > collection of relation information to somewhere a bit earlier in
> > > the planner. But not to outside the planner.
>
> > I'm considering moving the collection of attnotnull information before
> > pull_up_sublinks, in hopes of leveraging this info to pull up NOT IN
> > in the future, something like attached.
>
> Here is an updated version of the patch with some cosmetic changes and
> a more readable commit message. I'm wondering if it's good enough to
> be pushed. Any comments?
>

The comment about notnullattnums in struct RangeTblEntry says that:
* notnullattnums is zero-based set containing attnums of NOT NULL
* columns.

But in get_relation_notnullatts():
rte->notnullattnums = bms_add_member(rte->notnullattnums,
i + 1);

The notnullattnums seem to be 1-based.

--
Thanks,
Tender Wang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2025-03-26 06:10:03 Re: a pool for parallel worker
Previous Message Masahiko Sawada 2025-03-26 05:43:05 Re: [Patch] remove duplicated smgrclose