Re: [GENERAL] SQL Functions and plan time

2003-07-08 Thread Richard Huxton
On Tuesday 08 Jul 2003 7:48 pm, Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > Can I ask why, since the plan is constructed at query-time the parameters > > aren't substitued *before* planning? > > Because then the plan couldn't be re-used. A SQL function may be > executed many t

Re: [GENERAL] SQL Functions and plan time

2003-07-08 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Can I ask why, since the plan is constructed at query-time the parameters > aren't substitued *before* planning? Because then the plan couldn't be re-used. A SQL function may be executed many times in a query, so the plan has to be reusable. (Or, if y

[GENERAL] SQL Functions and plan time

2003-07-07 Thread Richard Huxton
I define an SQL function: CREATE FUNCTION foo(timestamptz) AS ' ...' LANGUAGE 'SQL'; Does the plan for the body get built at creation or execution time? I could have sworn it was execution time, but timings on one function suggest creation? For those new to functions, plpgsql always prepares i