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