Re: Performance: sql functions v. plpgsql v. plperl

From: Joel Burton <jburton(at)scw(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Performance: sql functions v. plpgsql v. plperl
Date: 2001-04-25 20:59:54
Message-ID: Pine.LNX.4.21.0104251656370.15130-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 25 Apr 2001, Tom Lane wrote:

> Joel Burton <jburton(at)scw(dot)org> writes:
> > Last night, I was doing some amateurish benchmarking and found that,
> > contrary to my (admittedly uninformed) expectation, sql functions seem
> > *slower* than plsql functions.
>
> IIRC, sql functions are re-parsed/planned on each execution, whereas
> plpgsql functions cache their parse trees and execution plans.
> Depending on exactly what you were doing, that might explain the
> difference.

Why is this?

I'm just delving into the source code in earnest for the first time, so,
forgive any awful errors, but it seems like we have the plumbing for this
in views/rules... couldn't the parse tree be cached from this for each
backend?

Or are SQL functions mildly deprecated since they could always be replaced
by the plpgsql function

begin
return ...
end;

?

--
Joel Burton <jburton(at)scw(dot)org>
Director of Information Systems, Support Center of Washington

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-04-25 21:03:51 Re: Performance: sql functions v. plpgsql v. plperl
Previous Message Alejandro Cicero 2001-04-25 19:25:46 Consulta