Performance difference between sql and pgsql function...

From: "Cristian Prieto" <cristian(at)clickdiario(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Performance difference between sql and pgsql function...
Date: 2005-11-02 15:32:19
Message-ID: 007401c5dfc2$9d2c41e0$6500a8c0@gt.ClickDiario.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

There any performance differences between a SQL function written in SQL
language or PL/psSQL language? For example:

Create or replace function sp_getfreq(
Var1 integer
) returns Boolean as
$$
Declare
Myval Boolean;
Begin
Select var1 in (select var3 from table1) into myval;
Return myval;
End;
$$
Language ‘plpgsql’ stable; 

And with:

Create or replace function sp_getfreq(
Var1 integer
) returns boolean as
$$
Select $1 in (select var3 from table1);
$$
Language ‘sql’ stable;

I know the function is really simple, but in theory which of the three would
run faster?

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2005-11-02 16:47:48 Re: improvise callbacks in plpgsql
Previous Message Tom Lane 2005-11-02 15:11:34 Re: insert performance for win32