dynamic queries vs static queries

From: lwu(at)mxlogic(dot)com (Litao Wu)
To: pgsql-admin(at)postgresql(dot)org
Subject: dynamic queries vs static queries
Date: 2004-04-05 21:54:04
Message-ID: 559b7ab0.0404051354.5a7c8f3d@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

Is there any performance difference between dynamic queries vs statis
queris in PL/pgSQL functions?

For example:

create function static_fn(int, character varying)...
pk_id ALIAS $1;
a_str ALIAS $2;
begin
update a_table
set a_column = a_str
where pk=pk_id;
...
END;
' LANGUAGE 'plpgsql';

vs
create function dynamic_fn(int, character varying)...
pk_id ALIAS $1;
a_str ALIAS $2;
begin
EXECUTE ''update a_table '' ||
''set a_column = '' || a_str ||
'' where pk='' || pk_id;
...
END;
' LANGUAGE 'plpgsql';

Browse pgsql-admin by date

  From Date Subject
Next Message David Filion 2004-04-05 21:58:30 Re: plpgsql editor(s)?
Previous Message Marc G. Fournier 2004-04-05 21:39:08 Re: Frequent 'deadlock detected' in 7.4 ... or just my bad