From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stefan Fehrenbach <stefan.fehrenbach@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: When can joins be avoided?
Date: Thu, 17 Nov 2022 09:49:20 -0500
Message-ID: <1826810.1668696560@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB9vtGACGyRjg132fu52rTRUu_m1Xz0ezPNdeba76DbC_Nsy3g@mail.gmail.com>
References: <CAB9vtGACGyRjg132fu52rTRUu_m1Xz0ezPNdeba76DbC_Nsy3g@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, stefan.fehrenbach@gmail.com, pgsql-performance@lists.postgresql.org
Subject: Re: When can joins be avoided?
In-Reply-To: <1826810.1668696560@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox