Re: LEFT JOINs not optimized away when not needed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Moshe Jacobson <moshe(at)neadwerx(dot)com>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>, Robert Mowlavi <robert(at)neadwerx(dot)com>, Chris Autry <chris(at)neadwerx(dot)com>
Subject: Re: LEFT JOINs not optimized away when not needed
Date: 2014-07-09 16:54:05
Message-ID: 16398.1404924845@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Jul 8, 2014 at 5:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Moshe Jacobson <moshe(at)neadwerx(dot)com> writes:
>>> On Tue, Jul 8, 2014 at 4:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> No. There is nothing about GROUP BY in the join removal logic.

>>> OK. Thank you. Is this something that would make sense to add?

>> Dunno. I don't recall any previous requests for such a thing, so I'd not
>> be inclined to add it unless it can be done very cheaply (in terms of both
>> code and runtime).

> I thought this was exactly what was being discussed on the "Allowing
> join removals for more join types" thread.

No, this is a completely different thing. The idea is that if the query
is grouping on outer-relation columns, you don't need to care if the inner
relation is unique or not, because it doesn't matter if there are multiple
matches.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2014-07-09 17:30:39 Re: LEFT JOINs not optimized away when not needed
Previous Message Robert Haas 2014-07-09 16:07:35 Re: LEFT JOINs not optimized away when not needed

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-07-09 16:54:55 Re: postgresql.auto.conf and reload
Previous Message Josh Berkus 2014-07-09 16:52:39 Re: postgresql.auto.conf and reload