Re: overhead of plpgsql functions over simple select

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Ivan Sergio Borgonovo" <mail(at)webthatworks(dot)it>, pgsql-general(at)postgresql(dot)org
Subject: Re: overhead of plpgsql functions over simple select
Date: 2008-10-24 04:46:22
Message-ID: 18918.1224823582@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> postgres=# create function simplefce(a int, b int) returns int as
> $$select $1 + $2$$ language sql immutable strict;
> CREATE FUNCTION
> postgres=# create function simplefce1(a int, b int) returns int as
> $$begin return a+b; end;$$ language plpgsql immutable strict;
> CREATE FUNCTION

That's a pretty unfair comparison, because that SQL function is simple
enough to be inlined. The place to use plpgsql is when you need some
procedural logic; at which point a SQL function simply fails to provide
the required functionality.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-10-24 05:03:35 Re: overhead of plpgsql functions over simple select
Previous Message Pavel Stehule 2008-10-24 03:44:06 Re: overhead of plpgsql functions over simple select