From: | Martin Hart <martin(at)zsdfherg(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | C functions quicker than Plpgsql? |
Date: | 2003-11-03 20:00:48 |
Message-ID: | 200311032000.48121.martin@zsdfherg.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
Given a stored procedure that runs entirely within the database (e.g. loop
through a few rows of table A, apply "some function" and create a few rows in
table B) - I am wondering what the performance benefits are of implementing
such a
function in C using the SPI vs plpgsql.
Obviously if "some function" is fairly involved then there may be an
advantage by coding it in C - but if it isn't will the C function
still execute faster?
as an unrealistic simple example...
create function test() returns void as '
declare
r record;
begin
for r in select * from table_a where x > 500 loop
insert into table_b (id) values (a.id);
end loop;
return;
end;
' language plpgsql;
now if i write it in C instead, what do i gain performance-wise?
thanks for any light you can shed on this...
Cheers,
Martin
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2003-11-03 20:12:04 | Re: Constraint Problem |
Previous Message | scott.marlowe | 2003-11-03 20:00:25 | Re: Constraint Problem |