On Thu, Apr 22, 2010 at 6:53 PM, Greg Sabino Mullane <greg@turnstep.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160
> I have written following trigger and trying to improve the performance by > using prepared query everytime. I have used spi_prepare to prepare the query > and $_SHARED global hash to persist the prepared plan but it doesn't seem to > work. Though $query will be same always in following trigger, it prepares > query everytime and never uses prepared plan. > Could anyone tell me what's wrong going on?
Works fine for me. Note that your elog outputs are switched - you are claiming the already prepared plan for the first time (if exists) and claiming the first prepare when in fact it is reusing (else).