Richard Huxton <dev(at)archonet(dot)com> writes:
> 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?
It's planned once per query. There's been some talk of building a
cross-query plan cache for SQL functions, like plpgsql has, but
nothing done yet.
regards, tom lane