Stefan Fehrenbach <stefan.fehrenbach@xxxxxxxxx> 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