From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Ivan Sergio Borgonovo" <mail(at)webthatworks(dot)it> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: overhead of plpgsql functions over simple select |
Date: | 2008-10-24 03:44:06 |
Message-ID: | 162867790810232044n7d918965p9d70775f9c268045@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
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
postgres=#
postgres=# select sum(simplefce(i,1)) from generate_series(1,100000) g(i);
sum
------------
5000150000
(1 row)
Time: 255,997 ms
postgres=# select sum(simplefce1(i,1)) from generate_series(1,100000) g(i);
sum
------------
5000150000
(1 row)
Time: 646,791 ms
Regards
Pavel Stehule
2008/10/23 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
> I'd like to encapsulate something that now is just a simple select
> in a plpgsql function now just to keep an interface consistent but
> even for well... encapsulating the sql.
>
> Right now a simple select statement will suffice.
>
> What kind of overhead a plpgsql that just return a select incur
> compared to a simple select?
>
> I'm not that worried of old query plans.
>
> thx
>
> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-10-24 04:46:22 | Re: overhead of plpgsql functions over simple select |
Previous Message | Jeff Davis | 2008-10-23 23:31:05 | Re: Storing questionnaire data |