Re: hashed subplan 5000x slower than two sequential operations - Mailing list pgsql-performance

From masterchief
Subject Re: hashed subplan 5000x slower than two sequential operations
Date
Msg-id 1295377019385-3346652.post@n5.nabble.com
Whole thread Raw
In response to Re: hashed subplan 5000x slower than two sequential operations  (Bryce Nesbitt <bryce2@obviously.com>)
Responses Re: hashed subplan 5000x slower than two sequential operations  (Віталій Тимчишин <tivv00@gmail.com>)
List pgsql-performance
> Tom Lane wrote:
>
> The only really effective way the planner knows to optimize an
> "IN (sub-SELECT)" is to turn it into a semi-join, which is not possible
> here because of the unrelated OR clause.  You might consider replacing
> this with a UNION of two scans of "contexts".  (And yes, I know it'd be
> nicer if the planner did that for you.)

In moving our application from Oracle to Postgres, we've discovered that a
large number of our reports fall into this category.  If we rewrite them as
a UNION of two scans, it would be quite a big undertaking.  Is there a way
to tell the planner explicitly to use a semi-join (I may not grasp the
concepts here)?  If not, would your advice be to hunker down and rewrite the
queries?
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/hashed-subplan-5000x-slower-than-two-sequential-operations-tp3297790p3346652.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.

pgsql-performance by date:

Previous
From: Lars
Date:
Subject: Migrating to Postgresql and new hardware
Next
From: Andy Colson
Date:
Subject: Re: Migrating to Postgresql and new hardware