Re: Prove a NOT IN's left-hand expressions non-nullable from quals

From: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Rui Zhao <zhaorui126(at)gmail(dot)com>, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Prove a NOT IN's left-hand expressions non-nullable from quals
Date: 2026-08-17 02:19:54
Message-ID: CAGjGUAL9niud=CrHYM-O2r0aD6s5rWE1MBT2CjtMpaKBMahNhA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HI

Thank you for updating the patch.
>
> One concern I had is the planning memory/time for nested joins. I may be
> missing something, but it seems that each node can copy and scan all
> accumulated descendant quals, potentially resulting in quadratic behavior.
> In my 160-join test, planning memory increased from 2.6 MB on master to 58
> MB with v2, even though no conversion was possible.
>
> Would it make sense, at minimum, to test the RHS first?
>
> if (under_not &&
> (!query_outputs_are_not_nullable(subselect) ||
> !sublink_testexpr_is_not_nullable(root, sublink, sqinfo)))
> return NULL;
>
> That would avoid unnecessary outer-side analysis when conversion is
> already impossible. However, unless I am overlooking something, the
> underlying quadratic behavior may still remain when conversions succeed.
>

Thanks

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-08-17 02:39:31 Re: Residual tsquery cleanups
Previous Message Tender Wang 2026-08-17 02:15:15 Re: [BUG] hstore integer overflow when constructing large values