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

From Andrus
Subject Re: Query runs forever after upgrading to 9.3
Date
Msg-id EEC90C67B4354FC0A73DF453B5894AD9@dell2
Whole thread Raw
In response to Re: Query runs forever after upgrading to 9.3  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Query runs forever after upgrading to 9.3
List pgsql-general
Hi,

>Just out of curiosity, what "earlier version" was that that was able to
>run this query quickly?

It was installed in customer site at May 2012 in Windows 2003 server and
latest RTM version of Postgres
x32 in this time was used.

In this year server was upgraded to Windows 2008 x64 server and Postgres 9.3
x64 was used, database was restored from backup copy.
After that this query started to run forever so I assumed that this was
Postgres version issue.

It is probably possible to try to reproduce the issue by restoring it to
earlier version.

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

I fixed the issue by using

create index tempkaivetoode on tempkaive(toode);
create index tempalgemutoode on tempalgsemu(toode);

and using exists.

Will your suggestion run faster ? Is it reasonable to switch to use your
suggestion ?

Andrus.



pgsql-general by date:

Previous
From: Gavin Flower
Date:
Subject: Re: new line in psotgres
Next
From: Tom Lane
Date:
Subject: Re: Query runs forever after upgrading to 9.3