Re: Procedural Languages

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: John Townsend <jtownsend(at)advancedformulas(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Procedural Languages
Date: 2012-06-07 08:29:55
Message-ID: 4FD06683.8000100@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/31/2012 10:36 PM, John Townsend wrote:
> There are least 10 Procedural Languages
> <http://en.wikipedia.org/wiki/PL/pgSQL> available for PostGreSQL. The
> one that comes with the installation is PL/pgSQL.
>
> Which ones do you use and why?

PL/PgSQL, and I avoid using anything else if at all possible. PL/PgSQL
is the only language that's guaranteed to be available w/o installing
additional runtimes, so it's nice and safe from the perspective of
moving backups around, future-proofing, etc. It's not the fastest thing
around for intensive computation, but it's very efficient when
interacting heavily with the database.

I'd love to use PL/Java for some things, but PostgreSQL's multiprocess
model doesn't play all that well with Java's multi-threading oriented
design. The JVM startup overhead is a bit high and you can't share
things between backends without expensive inter-process communication or
other hacks. Because Pg doesn't re-use backends, there's a huge amount
of JVM startup and shutdown cost.

I don't use PL/PythonU because there's no security model in Python, so
only the "untrusted" version is available. It also requires an external
runtime, and kind of sucks to install under Windows.

The new JavaScript PL looks exciting and I suspect it'll gain a *lot* of
traction in future. Most JavaScript runtimes don't allow file I/O or
other nasty things unless you explicitly enable it, they're fast to
start, many support JIT compilation, etc etc. Given how much less modern
JavaScript sucks, I expect to see tons more PL/JavaScript once Pg 9.2
starts seeing adoption.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2012-06-07 08:55:48 Re: acessibility for tables
Previous Message David Johnston 2012-06-07 04:26:45 Re: Counting # of consecutive rows with specified value(s)?