From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Илья Жарков <izharkov1243@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
Date: Sat, 07 Dec 2024 18:13:15 -0500
Message-ID: <3517444.1733613195@sss.pgh.pa.us> (raw)
In-Reply-To: <lqgxfkrngt6zh6ldwiw6nkcanrcxn5sravsoum6r6s7xfc3oib@tcknx7ngik3l>
References: <CAKE=rqQ-LHuh2eVsKC7ihkRJoCBZafSR72o3Xk4Xb=LcQMQfsA@mail.gmail.com>
<tx2q6qi4hn2diocmnwfjo5xw2m56iabz3fyeimk7oeyymy3u4b@4ria2zwtz5mp>
<3510224.1733609212@sss.pgh.pa.us>
<lqgxfkrngt6zh6ldwiw6nkcanrcxn5sravsoum6r6s7xfc3oib@tcknx7ngik3l>
Andres Freund <andres@anarazel.de> writes:
> On 2024-12-07 17:06:52 -0500, Tom Lane wrote:
>> One could imagine that we split up the join filter conditions into
>> "depends on RHS" and "doesn't depend on RHS" subsets, and make the
>> nestloop plan node evaluate the latter set only once per LHS row,
>> and then skip the inner-side scan when that condition fails.
> As I wrote in my other email, I'm also somewhat dubious it's worth having
> explicit code for this in nodeNestloop.c.
Yeah. Your idea of pushing the "doesn't depend on RHS" subset into
a one-time Result filter atop the RHS is interesting though. Then we
don't need any new executor machinery, but we pay for that with a more
complex planner patch. Not sure how hard that would be.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, izharkov1243@gmail.com
Subject: Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
In-Reply-To: <3517444.1733613195@sss.pgh.pa.us>
References: <CAKE=rqQ-LHuh2eVsKC7ihkRJoCBZafSR72o3Xk4Xb=LcQMQfsA@mail.gmail.com> <tx2q6qi4hn2diocmnwfjo5xw2m56iabz3fyeimk7oeyymy3u4b@4ria2zwtz5mp> <3510224.1733609212@sss.pgh.pa.us> <lqgxfkrngt6zh6ldwiw6nkcanrcxn5sravsoum6r6s7xfc3oib@tcknx7ngik3l> <3517444.1733613195@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox