Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store - Mailing list pgsql-general

From Robert Treat
Subject Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store
Date
Msg-id 1055450941.7070.338.camel@camel
Whole thread Raw
In response to Choosing Between PL/PGSQL or C/C++ for Triggers/Store Procs  (Clay Luther <claycle@cisco.com>)
Responses Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store  (Bruno Wolff III <bruno@wolff.to>)
List 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


pgsql-general by date:

Previous
From: Dmitry Tkach
Date:
Subject: Re: Choosing Between PL/PGSQL or C/C++ for Triggers/Store
Next
From: "Jim C. Nasby"
Date:
Subject: Re: [HACKERS] SAP and MySQL ... [and Benchmark]