Re: pull-up subquery if JOIN-ON contains refs to upper-query

From: Alena Rybakina <lena(dot)ribackina(at)yandex(dot)ru>
To: solaimurugan vellaipandiyan <drsolaimurugan(dot)v(at)gmail(dot)com>
Cc: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Petr Petrov <p(dot)petrov(at)postgrespro(dot)ru>
Subject: Re: pull-up subquery if JOIN-ON contains refs to upper-query
Date: 2026-05-12 17:19:27
Message-ID: 3c077371-bdcb-4537-aabe-eb944d8e1d07@yandex.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, thank you for your valuable feedback. If you have time you can test
it on sqlsmith (https://github.com/anse1/sqlsmith) -
it will give some corner cases that should be observed.

On 11.05.2026 08:20, solaimurugan vellaipandiyan wrote:
> Hi Alena,
>
> I did some additional testing on the latest patch and the behavior
> looks good in my environment so far.
>
> I verified the original EXISTS pull-up case and confirmed that after
> applying the patch the planner generates optimized Semi Join plans
> instead of EXISTS(SubPlan).
> I also tested several additional cases discussed in the thread, including:
> 1.NOT EXISTS queries
> 2. constant qual conditions
> 3. ANY array conditions
> 4. LEFT JOIN cases
> 5. FULL JOIN cases
> For the FULL JOIN scenarios, I checked both the execution plans and
> actual query results. In one case the planner simplified the query
> into a Hash Join plan, but the final query results remained correct.
> I additionally ran:
> - make check
> - make -C contrib check
> Both completed successfully in my environment and I did not observe
> planner crashes or incorrect query results during testing.
> Overall, the patch seems to improve planner behavior consistently for
> these EXISTS pull-up scenarios.
>
> Regards,
> Solaimurugan V
>
>
--
-----------
Best regards,
Alena Rybakina

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shawn McCoy 2026-05-12 17:34:10 Vacuumlo improvements
Previous Message Antonin Houska 2026-05-12 16:48:48 Re: Fix REPACK with WITHOUT OVERLAPS replica identity indexes