Re: [GENERAL] Stored Procedure performance / elegance question

2006-09-12 Thread Tony Caduto
Karen Hill wrote: x-no-archive:yes Hello. I have a stored procedure which returns a setof record. The function takes a few arguments, and if a couple of specific input values are null, it is required that the stored procedure perform different actions. I know that the planner does not store t

Re: [GENERAL] Stored Procedure performance / elegance question

2006-09-08 Thread Merlin Moncure
On 8 Sep 2006 14:39:54 -0700, Karen Hill <[EMAIL PROTECTED]> wrote: "Merlin Moncure" wrote: > you could of course do: > FOR rec IN SELECT * FROM test WHERE $1 is null or mydate > $1 loop [...] > or some such. This was a simple example. In reality, the structure of the query is altered, but ther

Re: [GENERAL] Stored Procedure performance / elegance question

2006-09-08 Thread Karen Hill
"Merlin Moncure" wrote: > On 8 Sep 2006 11:57:54 -0700, Karen Hill <[EMAIL PROTECTED]> wrote: > > I know that the planner does not store the plan when EXECUTE is used in > > a function, but the function looks better when the sql is created > > dynamically. > > my general rule is use static when yo

Re: [GENERAL] Stored Procedure performance / elegance question

2006-09-08 Thread Merlin Moncure
On 8 Sep 2006 11:57:54 -0700, Karen Hill <[EMAIL PROTECTED]> wrote: I know that the planner does not store the plan when EXECUTE is used in a function, but the function looks better when the sql is created dynamically. my general rule is use static when you can, dynamic when you have to. this i

Re: [GENERAL] stored procedure performance

2005-12-13 Thread Michael Glaesemann
On Dec 14, 2005, at 11:38 , Rick Gigger wrote: What actually fixes it is to run it a while and made sure there is a bunch of data there (even if it is deleted and not visible to anything) and run vacuum analyze. Then recreate the stored procedure. Then run the stored procedure. What ha