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

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, Tender Wang <tndrwang(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-07-30 07:55:43
Message-ID: CAMbWs48QA+SU+8YFXNFg9nt45hvhi9ZHtDvwmz_oktt3Pa24tg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 30, 2025 at 3:17 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> create table t (a int, b int, c int);
>
> explain (costs off)
> select * from t t1
> natural join t t2
> natural join t t3
> natural join t t4
> natural join t t5
> natural join t t6
> natural join t t7
> natural join t t8
> natural join t t9
> natural join t t10
> ;

FWIW, for this query, I've observed that table_open/table_close are
also called for each RTE_RELATION in build_physical_tlist(). Not sure
if we should also be concerned about those calls.

It's not clear to me how much performance impact an extra table_open
might have, especially when the lock is already held, and the relation
is likely present in the relcache.

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-07-30 08:07:32 Improve prep_buildtree
Previous Message Hayato Kuroda (Fujitsu) 2025-07-30 07:22:36 RE: POC: enable logical decoding when wal_level = 'replica' without a server restart