Re: [BUGS] LEFT JOINs not optimized away when not needed - Mailing list pgsql-hackers

From David Fetter
Subject Re: [BUGS] LEFT JOINs not optimized away when not needed
Date
Msg-id 20140708154502.GA6759@fetter.org
Whole thread Raw
List pgsql-hackers
On Tue, Jul 08, 2014 at 11:19:31AM -0400, Tom Lane wrote:
> Moshe Jacobson <moshe@neadwerx.com> writes:
> 
> > Seeing that there is only one output column, and that the results are
> > grouped by this output column, it seems to me that the optimizer should not
> > even look at the rest of the tables.
> 
> The GROUP BY has nothing to do with it, but if all the other tables' join
> keys are primary keys (or at least unique), I'd expect the planner to get
> rid of the joins.  However, I'm not sure whether it works completely when
> there are more than join_collapse_limit relations to worry about.

Eliminating JOINs seems orthogonal, at least in theory, to
join_collapse_limit.  What have I missed here, and how might they have
dependencies?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: geohas
Date:
Subject: How to use Makefile - pgxs without gcc -O2 ?
Next
From: Tom Lane
Date:
Subject: Re: How to use Makefile - pgxs without gcc -O2 ?