Re: Pulling up direct-correlated ANY_SUBLINK
От | Richard Guo |
---|---|
Тема | Re: Pulling up direct-correlated ANY_SUBLINK |
Дата | |
Msg-id | CAMbWs49cvkF9akbomz_fCCKS=D5TY=4KGHEQcfHPZCXS1GVhkA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Pulling up direct-correlated ANY_SUBLINK (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Tue, Sep 10, 2019 at 9:49 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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.
realized that pulling up direct-correlated ANY SubLink with LATERAL may
cause another problem that we cannot find any legal join order due to
the constraints imposed by LATERAL references. Below is an example:
select * from A where exists
(select * from B where A.i in (select C.i from C where C.j = B.j));
For this query, after we converting the ANY SubLink to a LATERAL
subquery, the subquery cannot be pulled up further into the parent query
because its qual contains lateral reference to 'B', which is outside a
higher semi join. When considering the join of 'A' and the 'subquery',
we decide it's not legal due to the LATERAL reference. As a result, we
end up with not finding any legal join order for level 2.
Thanks
Richard
В списке pgsql-hackers по дате отправления: