On May 1, 2007, at 12:16 PM, Jonah H. Harris wrote:
> On 5/1/07, Collin Peters <cadiolis@gmail.com> wrote:
>> Is it faster to use PREPARE for the various INSERT statements
>> inside a
>> plpgsql function? Perhaps I am wrong and it does its PREPARE work
>> when the function is parsed.
>
> IIRC, PLpgSQL automagically prepares each statement behind the scenes
> on the first use.
BTW, a good use for a version of EXECUTE that accepted parameters is
the trigger on a partitioned table to direct inserts to the
appropriate partition. Currently, you have to quote_literal(coalesce
(NEW.field, 'NULL')) in the dynamic statement.
--
Jim Nasby jim@nasby.net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)