Re: Pulling up direct-correlated ANY_SUBLINK

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <riguo(at)pivotal(dot)io>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pulling up direct-correlated ANY_SUBLINK
Date: 2019-09-10 13:48:48
Message-ID: 27733.1568123328@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <riguo(at)pivotal(dot)io> writes:
> Currently we do not try to pull up sub-select of type ANY_SUBLINK if it
> refers to any Vars of the parent query, as indicated in the code snippet
> below:
> if (contain_vars_of_level((Node *) subselect, 1))
> return NULL;
> Why do we have this check?

Because the result would not be a join between two independent tables.

> Can we try to pull up direct-correlated ANY SubLink with the help of
> LATERAL?

Perhaps. But what's the argument that you'd end up with a better
plan? LATERAL pretty much constrains things to use a nestloop,
so I'm not sure there's anything fundamentally different.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-09-10 14:13:49 Re: [PATCH] Move user options to the end of the command in pg_upgrade
Previous Message Tomas Vondra 2019-09-10 13:47:51 Re: accounting for memory used for BufFile during hash joins