Home > Archive > PostgreSQL Discussion > August 2005 > SPs performance...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SPs performance...
Cristian Prieto

2005-08-26, 8:23 pm

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!
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com