Andrei Lepikhov writes:
> Pardon the noise, but I'm curious why the optimiser must choose NestLoop
> in the case of lateral reference.
To pass down the current outer row's value of the lateral reference.
> It would be nice to provide alternatives. Because now we have some
> corner cases.
That
On 11/29/24 05:33, Tom Lane wrote:
Avoid mislabeling of lateral references when pulling up a subquery.
If we are pulling up a subquery that's under an outer join, and
the subquery's target list contains a strict expression that uses
both a subquery variable and a lateral-reference variable, it's
Richard Guo writes:
> This patch can also simplify my other patch, which is to avoid
> unnecessary wrapping for plain Vars/PHVs. We can check the new
> nullingrel_info to see if the nullingrels of the subquery RTE are a
> subset of the nullingrels of the lateral referenced rel, to determine
> if
On Sat, Nov 30, 2024 at 6:31 AM Tom Lane wrote:
> I wrote:
> > The ideas I'd been toying with last night involved a pre-scan over
> > the join tree to calculate the potential nullingrels of each leaf RTE
> > (same idea as RelOptInfo.nulling_relids, but of course we don't have
> > any RelOptInfos y
I wrote:
> The ideas I'd been toying with last night involved a pre-scan over
> the join tree to calculate the potential nullingrels of each leaf RTE
> (same idea as RelOptInfo.nulling_relids, but of course we don't have
> any RelOptInfos yet). That seems painful though because we'd have to
> upda
Richard Guo writes:
> I spent some time looking into this issue.
Thanks for looking at it!
> First of all, the lateral references cannot be outside of the lowest
> outer join above the subquery; otherwise, is_simple_subquery() would
> consider the subquery not eligible for pull-up.
Yeah. While
On Fri, Nov 29, 2024 at 10:44 AM Tom Lane wrote:
> Richard Guo writes:
> > On Fri, Nov 29, 2024 at 7:33 AM Tom Lane wrote:
> >> It seems to be sufficient to just not mark lateral
> >> references at all in this case. (I have a nagging feeling that more
> >> complexity may be needed in cases wher
Richard Guo writes:
> On Fri, Nov 29, 2024 at 7:33 AM Tom Lane wrote:
>> It seems to be sufficient to just not mark lateral
>> references at all in this case. (I have a nagging feeling that more
>> complexity may be needed in cases where there are several levels of
>> outer join, but some attemp
On Fri, Nov 29, 2024 at 7:33 AM Tom Lane wrote:
> It seems to be sufficient to just not mark lateral
> references at all in this case. (I have a nagging feeling that more
> complexity may be needed in cases where there are several levels of
> outer join, but some attempts to break it with that di