pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig James <craig_james@emolecules.com>
To: pgsql-performance@postgresql.org
Subject: Re: PostgreSQL Function Language Performance: C vs	PL/PGSQL
Date: Wed, 26 May 2010 10:09:41 -0700
Message-ID: <4BFD55D5.4040907@emolecules.com> (raw)
In-Reply-To: <20100526164716.GC21875@tamriel.snowman.net>
References: <AANLkTinPXHz0GMP6J6eWksip54AiCImJVNO4Yf4vzFm4@mail.gmail.com>
	<20100526161839.GA21875@tamriel.snowman.net>
	<AANLkTilqE1ODTmCtAqY6oUDnSYruapc6UdO0_ROf1-li@mail.gmail.com>
	<20100526163251.GB21875@tamriel.snowman.net>
	<AANLkTinskJ9en0Mstxp96ZNYywRkucuM0Hn74IN1Lh_H@mail.gmail.com>
	<20100526164716.GC21875@tamriel.snowman.net>

On 5/26/10 9:47 AM, Stephen Frost wrote:
> * Eliot Gable (egable+pgsql-performance@gmail.com) wrote:
>> Since PostgreSQL is written in C, I assume there is no
>> such additional overhead. I assume that the PL/PGSQL implementation at its
>> heart also uses SPI to perform those executions. Is that a fair statement?
>
> Right, but I also wouldn't expect a huge improvment either, unless
> you're calling these queries a ton, or the queries that you're calling
> from the pl/pgsql are pretty short-lived.
>
> Don't get me wrong, C is going to be faster, but it depends on exactly
> what's going on as to if it's going to be an overall improvment of, say,
> 10%, or a 10-fold improvment. :)

Or a 0.1% improvement, which is more likely.  Or that the PL/PGSQL version is even faster than the C version, because if you do any string regexp in your function, Perl has extremely efficient algorithms, probably better than you have time to write in C.

We use Perl extensively and have never had any complaints.  The database activity completely dominates all queries, and the performance of Perl has never even been noticable.

We use a C functions for a few things, and it is a big nuisance.  Every time you upgrade Postgres or your OS, there's a chance the recompile will fail because of changed header files.  Any bugs in your code crash Postgres itself.  We avoid C as much as possible (and I love C, been doing it since 1984).

Craig



view thread (12+ messages)  latest in thread

Message-ID: <4BFD55D5.4040907@emolecules.com>
Permalink:  ../4BFD55D5.4040907@emolecules.com/
Also on:    postgresql.org/message-id/4BFD55D5.4040907@emolecules.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: craig_james@emolecules.com
  Subject: Re: PostgreSQL Function Language Performance: C vs	PL/PGSQL
  In-Reply-To: <4BFD55D5.4040907@emolecules.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox