From: Nicolas Paris <nicolas.paris@riseup.net>
To: pgsql-performance@lists.postgresql.org
Subject: LEFT JOIN LATERAL optimisation at plan time
Date: Tue, 18 Sep 2018 09:06:36 +0200
Message-ID: <20180918070636.tp243ftlwpzrfrsd@riseup.net> (raw)
Hi,
For a traditional LEFT JOIN, in case the SELECT does not mention a field
from a joined table being unique , the planner removes the join. Eg:
SELECT a, b --,c
FROM table1
LEFT JOIN (select a, c from table2 group by a) joined USING (a)
However this behavior is not the same for LATERAL JOINS
SELECT a, b --,c
FROM table1
LEFT JOIN LATERAL (select a, c from table2 where table1.a = table2.a group by a) joined ON TRUE
In this case, the planner still consider the joined table. My guess is
it could remove it .
Any thought ?
--
nicolas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: nicolas.paris@riseup.net, pgsql-performance@lists.postgresql.org
Subject: Re: LEFT JOIN LATERAL optimisation at plan time
In-Reply-To: <20180918070636.tp243ftlwpzrfrsd@riseup.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox