Skip site navigation (1) Skip section navigation (2)

Re: Forcing a stored procedure recompile

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Mike McGavin <jester(at)NOSPAM(dot)mcsnospam(dot)vuw(dot)acNOSPAM(dot)nz>
Subject: Re: Forcing a stored procedure recompile
Date: 2004-08-31 18:53:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Mike McGavin wrote:

> Hello everyone.
> Can anyone suggest if there's a way to force a plpgsql stored procedure 
> to be recompiled every time that it's called, based on the values of the 
> parameters that it's given?  I assumed it would be possible, but 
> unfortunately haven't been able to find any documentation on how to 
> force a recompile at all, let alone automatically.
> I've encountered a situation where the standard precompiled generic 
> query plan isn't working at all well with the unknown variables that the 
> stored procedure receives.  It seems to do nicely if I replace them with 
> constants, though.  (Compilation time isn't really an issue in this 
> situation, but I'd like to leave everything in the stored procedure for 
> other reasons.)
> I could probably re-write the procedure to concatenate a string 
> containing the unknowns as constants and then EXECUTE it.  Doing it that 
> way seems a bit ugly, though, and it'd make maintenance a bigger problem.

Right now unfortunately this is the only one solution.

See the post on performance (8/28/2004) with the title:

ill-planned queries inside a stored procedure"

Gaetano Mendola

pgsql-general by date

Next:From: Jerry LeVanDate: 2004-08-31 18:59:52
Subject: Types and SRF's
Previous:From: Steinar H. GundersonDate: 2004-08-31 18:48:45
Subject: Re: Table UPDATE is too slow

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group