Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Илья Жарков <izharkov1243(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
Date: 2024-12-07 23:13:15
Message-ID: 3517444.1733613195@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2024-12-07 23:57:32 Re: CREATE SUBSCRIPTION - add missing test case
Previous Message Andres Freund 2024-12-07 23:07:16 Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table