Re: Queries within a function

From: Mridula Mahadevan <mmahadevan(at)stratify(dot)com>
To: Віталій Тимчишин <tivv00(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Queries within a function
Date: 2010-02-03 20:06:12
Message-ID: 0A59BA5B590B7E4A8D441196A9F17E904C68825D49@corpmail11.calpurnia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thank you all, You were right on the analyze. Insert statement with an aggregated subquery had a problem on an empty table.

I had to change the queries to do a simple insert then analyze on the table followed by an update with an aggregated sub query. That goes thru very fast.

-mridula

From: Віталій Тимчишин [mailto:tivv00(at)gmail(dot)com]
Sent: Wednesday, February 03, 2010 8:11 AM
To: Mridula Mahadevan
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Queries within a function

2010/2/2 Mridula Mahadevan <mmahadevan(at)stratify(dot)com<mailto:mmahadevan(at)stratify(dot)com>>
Hi,
I am running a bunch of queries within a function, creating some temp tables and populating them. When the data exceeds say, 100k the queries start getting really slow and timeout (30 min). when these are run outside of a transaction(in auto commit mode), they run in a few seconds. Any ideas on what may be going on and any postgresql.conf parameters etc that might help?
Thanks
Have you tried to analyze temp tables after you've populated them? Because AFAIK it won't do it automatically for tables created, filled and then used in same transaction.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2010-02-03 20:40:56 Re: System overload / context switching / oom, 8.3
Previous Message Andy Colson 2010-02-03 18:50:56 Re: Slow-ish Query Needs Some Love