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
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`
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
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