Re: Query runs forever after upgrading to 9.3 - Mailing list pgsql-general

From Tom Lane
Subject Re: Query runs forever after upgrading to 9.3
Date
Msg-id 32607.1384015717@sss.pgh.pa.us
Whole thread Raw
In response to Query runs forever after upgrading to 9.3  ("Andrus" <kobruleht2@hot.ee>)
Responses Re: Query runs forever after upgrading to 9.3
List pgsql-general
"Andrus" <kobruleht2@hot.ee> writes:
> Query
> SELECT * FROM toode
> WHERE toode in (SELECT toode FROM tempkaive)
>      OR toode in (SELECT toode FROM tempalgsemu)

> stops working after upgrading to 9.3 RTM in Windows from earlier version.

Just out of curiosity, what "earlier version" was that that was able to
run this query quickly?  Based on what you've said in this thread, I don't
see a reason for 9.3 to be slower than earlier releases for this.  The
default plan certainly sucks, but that would've been true in earlier
releases as well.

Personally I'd try to get rid of the OR, perhaps with

SELECT * FROM toode
WHERE toode in (SELECT toode FROM tempkaive UNION ALL
                SELECT toode FROM tempalgsemu)

You want to end up with a plan that has no "SubPlans" in it, and in
a quick check this looked promising.

            regards, tom lane


pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: new line in psotgres
Next
From: Scott Marlowe
Date:
Subject: Re: what could cause postgres to crash?