Re: Procedural Languages - Mailing list pgsql-general

From Craig Ringer
Subject Re: Procedural Languages
Date
Msg-id 4FD06683.8000100@ringerc.id.au
Whole thread Raw
In response to Procedural Languages  (John Townsend <jtownsend@advancedformulas.com>)
Responses Re: Procedural Languages  (Zenaan Harkness <zen@freedbms.net>)
List pgsql-general
On 05/31/2012 10:36 PM, John Townsend wrote:
There are least 10 Procedural Languages 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

pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Counting # of consecutive rows with specified value(s)?
Next
From: Willy-Bas Loos
Date:
Subject: Re: acessibility for tables