Re: Speed of different procedural language - Mailing list pgsql-performance

From Tom Lane
Subject Re: Speed of different procedural language
Date
Msg-id 18610.1135223111@sss.pgh.pa.us
Whole thread Raw
In response to Re: Speed of different procedural language  (Michael Fuhr <mike@fuhr.org>)
List pgsql-performance
Michael Fuhr <mike@fuhr.org> writes:
> Try looping through two million rows with PL/Perl or PL/Tcl and
> you'll probably see significantly worse performance than with
> PL/pgSQL -- so much worse that I'd be surprised to see those languages
> make up the difference with whatever processing they'd be doing for
> each row unless it was something they're particularly good at and
> PL/pgSQL is particularly bad at.

I'd expect plpgsql to suck at purely computational tasks, compared to
the other PLs, but to win at tasks involving database access.  These
are two sides of the same coin really --- plpgsql is tightly tied to the
PG query execution engine, to the extent of using it even for simply
adding 2 and 2, but that also gives it relatively low overhead for
invoking a database query.  Perl, Tcl, et al have their own
computational engines and can easily beat the PG SQL engine for simple
arithmetic and string-pushing.  But they pay a high overhead for
calling back into the database engine.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Arthurs
Date:
Subject: Re: What's the best hardver for PostgreSQL 8.1?
Next
From: Qingqing Zhou
Date:
Subject: Re: CPU and RAM