Re: pull-up subquery if JOIN-ON contains refs to upper-query - Mailing list pgsql-hackers

From Ilia Evdokimov
Subject Re: pull-up subquery if JOIN-ON contains refs to upper-query
Date
Msg-id 32446f52-1b18-499a-a77b-d6b66ad0f4cf@tantorlabs.com
Whole thread Raw
In response to Re: pull-up subquery if JOIN-ON contains refs to upper-query  (Alena Rybakina <a.rybakina@postgrespro.ru>)
List pgsql-hackers
On 02.04.2025 19:39, Alena Rybakina wrote:
>
> I see that I need to add a walker that, when traversing the tree, 
> determines whether there are conditions under which pull-up is 
> impossible - the presence of
> volatility of functions and other restrictions, and leave the 
> transformation for the var objects that I added before, I described it 
> here.
>

I have some concerns about pulling up every clause from the subquery 
with one column. In particular, not every clause is safe or beneficial 
to pull up: OR-clauses, CASE expressions, nested sublinks could 
significantly change how the planner estimates the number of rows or 
applies filters, especially when they are not true join predicates. 
Pulling them up might lead to worse plans, or even change the semantics 
in subtle ways. I think before applying such transformations, we should 
make sure they are not only safe but actually improve the resulting plan.




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: AIX support
Next
From: Yugo NAGATA
Date:
Subject: Re: Extend ALTER DEFAULT PRIVILEGES for large objects