plpgsql: penalty due to double evaluation of parameters

From: Nikhils <nikkhils(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, rushabh(dot)lathia(at)gmail(dot)com
Subject: plpgsql: penalty due to double evaluation of parameters
Date: 2008-05-20 10:32:20
Message-ID: d3c4af540805200332x4631a489n857ddd25fa6abe3c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Within exec_prepare_plan there are calls to exec_eval_datum to identify the
argtypes of the involved parameters. However exec_eval_datum actually fills
up value, isnull entries in these cases causing unnecessary additional calls
when all we need is the datum type. Such unnecessary evaluation of values
might prove to be very costly later since this quirk of exec_eval_datum
usage is not so visible. Worse still it could cause bugs if some evaluations
have side-effects across multiple evals. It might make sense to introduce a
new function exec_eval_datum_type to address this or exec_eval_datum could
itself be modified for cases where we just need the datum type. Should I
cook up a patch for this? I am inclined towards introducing a new function
(but that means that any new datum related changes need to be carried out in
2 functions instead of one currently).

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sam Mason 2008-05-20 10:37:35 Re: triggers on prepare, commit, rollback... ?
Previous Message Fabien COELHO 2008-05-20 10:09:44 Re: triggers on prepare, commit, rollback... ?