Re: Unnecessary lateral dependencies implied by PHVs - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Unnecessary lateral dependencies implied by PHVs
Date
Msg-id CAKU4AWoEqy3kGWWYgNbNDe=9DyuA54Jb=6bSLWk3PuF8rwsWqg@mail.gmail.com
Whole thread Raw
In response to Unnecessary lateral dependencies implied by PHVs  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Unnecessary lateral dependencies implied by PHVs
List pgsql-hackers
Hi Richard:

On Mon, Oct 10, 2022 at 10:35 AM Richard Guo <guofenglinux@gmail.com> wrote:
... I'm asking because
PHVs may imply lateral dependencies which may make us have to use
nestloop join.

I thought lateral join imply nestloop join,  am I missing something?  Here is my simple
testing. 

postgres=# explain (costs off) select * from r1 join lateral (select r1.a from r2) on true;
         QUERY PLAN
----------------------------
 Nested Loop
   ->  Seq Scan on r1
   ->  Materialize
         ->  Seq Scan on r2
(4 rows)

Time: 0.349 ms
postgres=# set enable_nestloop to off;
SET
Time: 0.123 ms

postgres=# explain (costs off) select * from r1 join lateral (select r1.a from r2) on true;
         QUERY PLAN
----------------------------
 Nested Loop
   ->  Seq Scan on r1
   ->  Materialize
         ->  Seq Scan on r2
(4 rows)

--
Best Regards
Andy Fan

pgsql-hackers by date:

Previous
From: Zheng Li
Date:
Subject: Re: Support logical replication of DDLs
Next
From: "kuroda.hayato@fujitsu.com"
Date:
Subject: RE: TRAP: FailedAssertion("prev_first_lsn < cur_txn->first_lsn", File: "reorderbuffer.c", Line: 927, PID: 568639)