Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Clay Luther <claycle(at)cisco(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store
Date: 2003-06-12 20:49:01
Message-ID: 1055450941.7070.338.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2003-06-12 at 14:54, Clay Luther wrote:
> For a very complex database in which we plan to implement database rules
> via triggers, I need some information on which language, PL/PGSQL or
> C/C++ provides the most "bang for the buck" with respect to performance.
> One initially presumes the C/C+ stored procs/triggers will be faster,
> but after reading some posts on the list about the Query Planner and
> PL/PGSQL, I was wondering if using PL/PGSQL might not be better.
>
> 1) Is there a clear-cut choice when performance is the issue?

If performance is the issue then C functions are the way to go.

> 2) Is there a fuzzy choice at work here? Perhaps PL/PGSQL for simple,
> obvious stored proces/triggers, but C/C++ for complexity?
>

Generally I'd say no, *if performance is the issue*. The main case
(imho) you'd want to use plpgsql or sql functions is becuase they are a
lot easier to write and maintain. If you don't care about that (and your
skill level with C might be such that you don't) then C functions are
the way to go.

BTW - If you ever feel the motivation to write a tutorial, a basic
tutorial on converting plpgsql functions to C functions would be pretty
neat.

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2003-06-12 20:57:55 Re: [HACKERS] SAP and MySQL ... [and Benchmark]
Previous Message Dmitry Tkach 2003-06-12 20:37:57 Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store