LEFT JOIN LATERAL optimisation at plan time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux