Re: [GENERAL] Use cases for lateral that do not involve a set returning function

2014-12-10 Thread Merlin Moncure
On Tue, Dec 9, 2014 at 4:24 AM, Albe Laurenz wrote: > SELECT ... > FROM people p > LEFT JOIN LATERAL (SELECT * FROM names n > WHERE n.people_id = p.people_id > AND current_timestamp > n.validfrom > ORDER BY n.validfrom DE

Re: [GENERAL] Use cases for lateral that do not involve a set returning function

2014-12-09 Thread AJ Welch
Thanks for the response. Yea, using lateral there definitely reads better to me than using a correlated subquery. And it makes sense that performance is ok since you're filtering on a specific person's id (as you hinted at with `WHERE p.id = ...`) and the nested loop forced by `order by...limit 1`

Re: [GENERAL] Use cases for lateral that do not involve a set returning function

2014-12-09 Thread Albe Laurenz
AJ Welch wrote: > http://blog.heapanalytics.com/postgresqls-powerful-new-join-type-lateral/ > > I suspected some of the claims in the post may not have been accurate. This > one in particular: > > "Without lateral joins, we would need to resort to PL/pgSQL to do this > analysis. Or, if our data

[GENERAL] Use cases for lateral that do not involve a set returning function

2014-12-06 Thread AJ Welch
I was reading this post the other day: http://blog.heapanalytics.com/postgresqls-powerful-new-join-type-lateral/ I suspected some of the claims in the post may not have been accurate. This one in particular: "Without lateral joins, we would need to resort to PL/pgSQL to do this analysis. Or, if