Re: Queries within a function - Mailing list pgsql-performance

From Tom Lane
Subject Re: Queries within a function
Date
Msg-id 29024.1265138879@sss.pgh.pa.us
Whole thread Raw
In response to Queries within a function  (Mridula Mahadevan <mmahadevan@stratify.com>)
Responses Re: Queries within a function  (Mridula Mahadevan <mmahadevan@stratify.com>)
List pgsql-performance
Mridula Mahadevan <mmahadevan@stratify.com> writes:
>  I am running a bunch of queries within a function, creating some temp tables and populating them. When the data
exceedssay, 100k the queries start getting really slow and timeout (30 min). when these are run outside of a
transaction(inauto commit mode), they run in a few seconds. Any ideas on what may be going on and any postgresql.conf
parametersetc that might help? 

I'll bet the function is caching query plans that stop being appropriate
once the table grows in size.  You might have to resort to using
EXECUTE, although if you're on 8.4 DISCARD PLANS ought to help too.

            regards, tom lane

pgsql-performance by date:

Previous
From: Rob
Date:
Subject: System overload / context switching / oom, 8.3
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb)