Re: When can joins be avoided? - Mailing list pgsql-performance

From Tom Lane
Subject Re: When can joins be avoided?
Date
Msg-id 1826810.1668696560@sss.pgh.pa.us
Whole thread Raw
In response to When can joins be avoided?  (Stefan Fehrenbach <stefan.fehrenbach@gmail.com>)
List pgsql-performance
Stefan Fehrenbach <stefan.fehrenbach@gmail.com> writes:
> I'm interested in the rules that Postgres uses to avoid joins. Are
> these documented somewhere? If I had to look at the source code, where
> would I start?

src/backend/optimizer/plan/analyzejoins.c

> They don't seem to match my intuition about which joins
> could be avoided.

I believe only left joins to single tables can be elided ATM.
It's too hard to prove uniqueness of the join key in more-
complicated cases.

            regards, tom lane



pgsql-performance by date:

Previous
From: Stefan Fehrenbach
Date:
Subject: When can joins be avoided?
Next
From: Luca Ferrari
Date:
Subject: why choosing an hash index instead of the btree version even if the cost is lower?