From: | Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | stored procedures and dynamic queries |
Date: | 2007-12-03 17:51:48 |
Message-ID: | 20071203185148.0ee09b31@webthatworks.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Any general rule about dynamically generated queries in stored
procedures vs. performances?
I was going to write stuff as simple as
create or replace function EditQty(int, int, int, varchar(10))
returns boolean as
'
declare
_uid alias for $1;
_aid alias for $2;
_qty alias for $3;
_table alias $4;
_modified timestamp;
begin
_table := 'shop_commerce_basket' || _table
_modified := now();
update _table
set qty=_qty,
modified=_modified
where uid=_uid and aid=_aid;
if not found then
insert into _table (uid, aid, qty)
values(_uid,_aid,_qty);
end if;
end;
' language plpgsql;
Is it going to perform worse than with a static table name?
Where can I find some clue about the effects of similar decisions?
thx
--
Ivan Sergio Borgonovo
http://www.webthatworks.it
From | Date | Subject | |
---|---|---|---|
Next Message | brian | 2007-12-03 18:01:14 | Re: initdb - encoding question |
Previous Message | Josh Harrison | 2007-12-03 17:51:27 | initdb - encoding question |