What is the difference between LATERAL JOIN and a subquery in PostgreSQL?

Since Postgres came out with the ability to do LATERAL joins, I’ve been reading up on it, since I currently do complex data dumps for my team with lots of inefficient subqueries that make the overall query take four minutes or more.

I understand that LATERAL joins may be able to help me, but even after reading articles like this one from Heap Analytics, I still don’t quite follow.

What is the use case for a LATERAL join? What is the difference between a LATERAL join and a subquery?

5 Answers
5

Leave a Comment