From: Tom Lane <tgl@sss.pgh.pa.us>
To: Moshe Jacobson <moshe@neadwerx.com>
Cc: pgsql-bugs@postgresql.org
Cc: Robert Mowlavi <robert@neadwerx.com>
Cc: Chris Autry <chris@neadwerx.com>
Subject: Re: LEFT JOINs not optimized away when not needed
Date: Tue, 08 Jul 2014 16:40:28 -0400
Message-ID: <709.1404852028@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJ4CxLnPdAJ9aHTe65TLBN1X2Xdb3g1Q0-hKt2g7+1VNadGWDw@mail.gmail.com>
References: <CAJ4CxLkrWctbEhoshWvxnEDi9=PvoDbWzdf5OJqvfv840Hv0_Q@mail.gmail.com>
<8401.1404832771@sss.pgh.pa.us>
<CAJ4CxLnRUjVAsj+KuWzDtRotsuR7tjRqsAmtsEaL1vwSqQRkog@mail.gmail.com>
<30516.1404848833@sss.pgh.pa.us>
<CAJ4CxLnPdAJ9aHTe65TLBN1X2Xdb3g1Q0-hKt2g7+1VNadGWDw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Moshe Jacobson <moshe@neadwerx.com> writes:
> On Tue, Jul 8, 2014 at 3:47 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> AFAICS, the eight
>> un-removed joins are either joining to non-unique keys, or can't be
>> removed because their tables are needed to provide joining columns for
>> un-removable joins.
> My point is that even if the column to which we are joining is a non-unique
> key, there should be no need to look at that table if the output does not
> include any values from that table, and there are no filters on that
> table's values, and all output columns are in the GROUP BY. Is the planner
> not smart enough to notice this?
No. There is nothing about GROUP BY in the join removal logic.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, moshe@neadwerx.com, robert@neadwerx.com, chris@neadwerx.com
Subject: Re: LEFT JOINs not optimized away when not needed
In-Reply-To: <709.1404852028@sss.pgh.pa.us>
References: <CAJ4CxLkrWctbEhoshWvxnEDi9=PvoDbWzdf5OJqvfv840Hv0_Q@mail.gmail.com> <8401.1404832771@sss.pgh.pa.us> <CAJ4CxLnRUjVAsj+KuWzDtRotsuR7tjRqsAmtsEaL1vwSqQRkog@mail.gmail.com> <30516.1404848833@sss.pgh.pa.us> <CAJ4CxLnPdAJ9aHTe65TLBN1X2Xdb3g1Q0-hKt2g7+1VNadGWDw@mail.gmail.com> <709.1404852028@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