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';