Re: LEFT JOINs not optimized away when not needed - Mailing list pgsql-bugs

From Moshe Jacobson
Subject Re: LEFT JOINs not optimized away when not needed
Date
Msg-id CAJ4CxLnRUjVAsj+KuWzDtRotsuR7tjRqsAmtsEaL1vwSqQRkog@mail.gmail.com
Whole thread Raw
In response to Re: LEFT JOINs not optimized away when not needed  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LEFT JOINs not optimized away when not needed
List pgsql-bugs
Tom,

Thanks for the reply.

On Tue, Jul 8, 2014 at 11:19 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> What's your setting of join_collapse_limit, and if it's less than
> 27, does raising it fix this query?
>

We raised it to 30 and restarted postgres but the query plan still touched
all of the tables. I'm not sure


> 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.
>

Not all of the join columns are unique, but most of them are unique, and
all of them are indexed on one side or the other... FWIW.


Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc. <http://www.neadwerx.com>
2323 Cumberland Parkway =C2=B7 Suite 201 =C2=B7 Atlanta, GA 30339

"Quality is not an act, it is a habit." -- Aristotle

pgsql-bugs by date:

Previous
From: David Fetter
Date:
Subject: Re: LEFT JOINs not optimized away when not needed
Next
From: Tom Lane
Date:
Subject: Re: LEFT JOINs not optimized away when not needed