Skip site navigation (1) Skip section navigation (2)

Re: Speed of different procedural language

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Speed of different procedural language
Date: 2005-12-22 03:45:11
Message-ID: 18610.1135223111@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Michael Fuhr <mike(at)fuhr(dot)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

In response to

pgsql-performance by date

Next:From: Qingqing ZhouDate: 2005-12-22 04:01:12
Subject: Re: CPU and RAM
Previous:From: Tom ArthursDate: 2005-12-22 03:34:00
Subject: Re: What's the best hardver for PostgreSQL 8.1?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group