Re: Accessing Database Data from C Function - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Accessing Database Data from C Function
Date
Msg-id b42b73150608100628s7af5e60eh9b0259973606ed4d@mail.gmail.com
Whole thread Raw
In response to Re: Accessing Database Data from C Function  ("Jeffrey Bigham" <jbigham@cs.washington.edu>)
List pgsql-general
On 8/8/06, Jeffrey Bigham <jbigham@cs.washington.edu> wrote:
> Not really.  Basically I know C decently enough and would have to
> learn PL/pgSQL (although it looks pretty easy).  Perl sounds quite
> attractive for the added benefit of text-processing as you mention.  I
> also have some vague understanding that C might be faster.  I hope I'm
> not opening a can-of-worms, but is C actually faster?

IMO, pl/pgsql should be the first sp language you learn and the
primary language of development for strored procedures.  It is simply
better than most other pl languages for data processing and ease of
maitenance.

There are two reasons why you might want to use C: one is that you
might want to interface with a C library and make it callable from
SQL.  You should check out Magnus Hagander's integration of OpenLDAP
for a good example of this (check his blog).  Note that  Magnus who is
in my opinion an expert C programmer only did this after trying ther
perl implementation and finding it unworkable.

another reason to use C is to expose some database internals.  for
example, in C you can invoke a function by it's oid which is currently
impossible to do in sql/plpgsql without some serious acrobatics.

Aside from that, I would avoid.  One of the reasons databases were
invented was so we don't have to use C for data processing (or COBOL,
etc.), or at least not until the hard work has already been done.

merlin

pgsql-general by date:

Previous
From: "Silvela, Jaime \(Exchange\)"
Date:
Subject: corruption - toasted table
Next
From: "Merlin Moncure"
Date:
Subject: Re: Tuning to speed select