I need to fine tuning my postgresql for
performance, I depend a lot in a couple and few SPs to made a sort of kind of
tasks, the most of those pgsql sps are made in pl/pgsql, most of them are
simple:
create or replace function sp_one(id
integer)
returns setof table1 as
$$
declare
var table1%rowtype;
begin
for var in (select * from table1
where myid=id) loop
return next
var;
end loop;
return;
end;
$$
language 'plpgsql' stable;
I think this simple sp would be so much easy
as
create or replace function sp_one(id
integer)
returns setof table1 as
$$
select * from table1 where
myid=$1;
$$
language 'sql' stable;
I guess it sounds more simple but I don't know if
it add performance issues in a language or in a simple "inline" sql
declarartion...
There are a few more sps a little more complex,
mainly in pl/pgsql but I don't know that if I write them in C language it would
add more speed to the execution of the code (most of them made a couple of
queries)...
Any help?
Thanks a lot!
|