Re: Query runs forever after upgrading to 9.3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrus" <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query runs forever after upgrading to 9.3
Date: 2013-11-09 16:48:37
Message-ID: 32607.1384015717@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andrus" <kobruleht2(at)hot(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2013-11-09 18:46:08 Re: what could cause postgres to crash?
Previous Message Alban Hertroys 2013-11-09 13:38:28 Re: new line in psotgres