Re: Query runs forever after upgrading to 9.3

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-11-09 20:37:53 Re: Query runs forever after upgrading to 9.3
Previous Message Gavin Flower 2013-11-09 20:18:24 Re: new line in psotgres