Sunday, May 25, 2008

Re: [HACKERS] plpgsql: penalty due to double evaluation of parameters

"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> I don't buy the performance argument unless I see some test results
> demonstrating it; exec_prepare_plan is only called on the first
> invocation of a statement. What kind of side-effects could
> exec_eval_datum call have?

In principle, if you subscript TG_ARGV[] with an expression that has
visible side-effects, you could have unexpected behavior here. I think
though that the right fix is to get rid of the special treatment of
TG_ARGV[] and make it a ordinary variable with type text[], instead
of being its very own class of datum. The current implementation has
a lot of other misbehaviors for TG_ARGV[], like not being able to apply
array operations to it.

I agree that worrying about the performance is pointless, considering
the cost of the SPI_prepare_cursor() that we're about to do in the one
place where there could be a use for a get-the-type-only call.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

No comments: