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

Re: Speed of different procedural language

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Speed of different procedural language
Date: 2005-12-21 21:24:42
Message-ID: 20051221212442.GA59736@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-performance
On Wed, Dec 21, 2005 at 12:06:47PM +0100, Steinar H. Gunderson wrote:
> On Sun, Dec 18, 2005 at 01:10:21AM -0000, Ben Trewern wrote:
> > I know I should be writing these in C but that's a bit beyond me.  I was 
> > going to try PL/Python or PL/Perl or even PL/Ruby.  Has anyone any idea 
> > which language is fastest, or is the data access going to swamp the overhead 
> > of small functions?
> 
> I'm not sure if it's what you ask for, but there _is_ a clear difference
> between the procedural languages -- I've had a 10x speed increase from
> rewriting PL/PgSQL stuff into PL/Perl, for instance.

The difference is clear only in specific cases; just because you
saw a 10x increase in some cases doesn't mean you can expect that
kind of increase, or indeed any increase, in others.  I've seen
PL/pgSQL beat all other PL/* challengers handily many times,
especially when the function does a lot of querying and looping
through large result sets.

I tend to use PL/pgSQL except in cases where PL/pgSQL can't do what
I want or the job would be much easier in another language (e.g.,
string manipulation, for which I'd use PL/Perl or PL/Ruby).  Even
then I might use the other language only to write small functions
that a PL/pgSQL function could call.

As Merlin suggested, maybe Ben could tell us what he wants to do
that he thinks should be written in C or a language other than
PL/pgSQL.  Without knowing what problem is to be solved it's near
impossible to recommend an appropriate tool.

-- 
Michael Fuhr

In response to

Responses

pgsql-performance by date

Next:From: Steinar H. GundersonDate: 2005-12-21 21:38:10
Subject: Re: Speed of different procedural language
Previous:From: Merlin MoncureDate: 2005-12-21 20:43:43
Subject: Re: Speed of different procedural language

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