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 its plan at "compile" time
so doesn't have actual values available to refine its plan.
--
Richard Huxton