Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-11-09 Thread Tom Lane
"Andrus" writes: >> 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. That would probably have been 9.1.someth

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-11-09 Thread Andrus
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 an

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-11-09 Thread Tom Lane
"Andrus" 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

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread bricklen
On Mon, Sep 23, 2013 at 9:50 AM, Andrus wrote: > http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server > wrote that max reasonable value in Windows for shared_buffers is 512MB > Is my setting shared_buffers= 2400MB reasonable in Windows ? > Someone else will hopefully answer that questi

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
Hi, >For cluster-wide setting you will probably want to drop that significantly -- >start lower, as in somewhere around 10MB >and work up from there as necessary. >For the queries you are finding slow (the reason for these emails) you can set >>work_mem specifically for the session. >Eg. >set

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
Hi! >Could you also post the results of the following query? >SELECT name, current_setting(name), source >FROM pg_settings >WHERE source NOT IN ('default', 'override'); In real server where problem is: 1 DateStyle ISO, DMY session 2 default_text_sea

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread bricklen
On Mon, Sep 23, 2013 at 9:12 AM, Andrus wrote: > > work_mem = 400MB > > Hope that this is OK. > For cluster-wide setting you will probably want to drop that significantly -- start lower, as in somewhere around 10MB and work up from there as necessary. For the queries you are finding slow (the re

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
Hi, >>21 shared_buffers 2400MB configuration file >What are effective_cache_size and work_mem set to? The defaults? Yes. >They are good candidates to be increased. effective_cache_size could be set to >(for example) 10GB, depending on >how much memory gets consumed

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread bricklen
On Mon, Sep 23, 2013 at 8:33 AM, Andrus wrote: > Hi! > >Could you also post the results of the following query? > >SELECT name, current_setting(name), source > >FROM pg_settings > >WHERE source NOT IN ('default', 'override'); > In real server where problem is: > > > 21 shared_buffers

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
o.toode = i.toode); Is this best fix ? Andrus. From: Andrus Sent: Monday, September 23, 2013 6:06 PM To: Jayadevan M Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Query runs forever after upgrading to 9.3 Hi, thank you. >Could you please post EXPLAIN for that query? As recomm

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread bricklen
On Mon, Sep 23, 2013 at 8:06 AM, Andrus wrote: > > >Could you please post EXPLAIN for that query? > Could you also post the results of the following query? SELECT name, current_setting(name), source FROM pg_settings WHERE source NOT IN ('default', 'override'); Also, what is the total memory in

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
Hi, thank you. >Could you please post EXPLAIN for that query? As recommend I changed query to use exists : SELECT * FROM toode o WHERE exists (SELECT toode FROM tempkaive i where o.toode = i.toode ) OR EXISTS (SELECT toode FROM tempalgsemu i WHERE o.toode = i.toode) It still hangs in same w

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
Hi, Thank you. Generally, WHERE IN (SELECT) should be rewritten as WHERE EXISTS (SELECT): SELECT * FROM toode o WHERE EXISTS (SELECT toode FROM tempkaive i WHERE o.toode = i.toode) OR EXISTS (SELECT toode FROM tempalgsemu i WHERE o.toode = i.toode) I re-wrote it. It now hangs in this line

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Jayadevan M
Could you please post EXPLAIN for that query? How 'fat' are the temporary tables - just a couple of columns or really wide? On Mon, Sep 23, 2013 at 7:08 PM, Andrus wrote: > Query > > SELECT * FROM toode > WHERE toode in (SELECT toode FROM tempkaive) > OR toode in (SELECT toode FROM tempalg

Re: [GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Christoph Berg
Re: Andrus 2013-09-23 > SELECT * FROM toode > WHERE toode in (SELECT toode FROM tempkaive) > OR toode in (SELECT toode FROM tempalgsemu) Generally, WHERE IN (SELECT) should be rewritten as WHERE EXISTS (SELECT): SELECT * FROM toode o WHERE EXISTS (SELECT toode FROM tempkaive i WHERE o.toode

[GENERAL] Query runs forever after upgrading to 9.3

2013-09-23 Thread Andrus
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. Task Manager shows that postgres.exe process has constantly 13% CPU usage (this is 8 core computer) a