Tag: join
About cross join in PostgreSQL
© Laurenz Albe 2021 For many people, “cross join” is something to be afraid of. They remember the time when they forgot the join condition and the DBA was angry, because the query hogged the CPU and filled the disk. However, there are valid use cases for cross joins which I want to explore in […]
Join strategies and performance in PostgreSQL
© Laurenz Albe 2020 (Updated 2023-02-24) There are three join strategies in PostgreSQL that work quite differently. If PostgreSQL chooses the wrong strategy, query performance can suffer a lot. This article explains the join strategies, how you can support them with indexes, what can go wrong with them and how you can tune your joins […]
PostgreSQL: Implicit vs. explicit joins
If you happen to be an SQL developer, you will know that joins are really at the core of the language. Joins come in various flavors: Inner joins, left joins, full joins, natural joins, self joins, semi-joins, lateral joins, and so on. However, one of the most important distinctions is the difference between implicit and […]
Join pruning – Cool stuff in PostgreSQL
The PostgreSQL optimizer is really a wonderful piece of software, which is capable of doing great things. One of those great things is so called “join pruning”. In case PostgreSQL is able to detect a join which is actually not needed for execution, it will automatically remove it from the plan. Removing joins from the […]
Outer joins revisited
Some time ago I have already written about joins and especially about outer joins. As we see people repeatedly making the same errors over and over again I thought that it might be worth to address things once again – maybe I can rescue some souls and prevent some bugs. Here is a simplistic example: […]