SPs performance...

From: "Cristian Prieto" <cristian(at)clickdiario(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SPs performance...
Date: 2005-08-26 18:12:57
Message-ID: 002401c5aa69$ca411cc0$6500a8c0@gt.ClickDiario.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

Browse pgsql-general by date

  From Date Subject
Next Message Matt Miller 2005-08-26 18:30:07 Re: Postgresql replication
Previous Message Bruno Wolff III 2005-08-26 17:41:14 Re: postgresql performance degradation over time....