Re: Optimizer issue -- bad query plan? - Mailing list pgsql-general

From David G Johnston
Subject Re: Optimizer issue -- bad query plan?
Date
Msg-id 1402007911350-5806264.post@n5.nabble.com
Whole thread Raw
In response to Optimizer issue -- bad query plan?  (Moshe Jacobson <moshe@neadwerx.com>)
Responses Re: Optimizer issue -- bad query plan?
List pgsql-general
Moshe Jacobson wrote
> I have the following query:
> [...]
> The EXPLAIN ANALYZE for this query indicates that all of the tables in the
> query are being joined despite the fact that they are not needed at all.
>
> Why is this?

Without definitions of all the tables involved, as well as knowing what
version you are running this query on, it is impossible to explain why.

https://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.0

Read the section named "Join Removal".

It would seem that in theory at least some of these could be removed -
though maybe not all of them - if you are running 9.0+ (possibly after some
schema changes).

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Optimizer-issue-bad-query-plan-tp5806260p5806264.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Moshe Jacobson
Date:
Subject: Re: Optimizer issue -- bad query plan?
Next
From: Keith Fiske
Date:
Subject: Re: Merge a sharded master into a single read-only slave