Re: Accessing Database Data from C Function

From: Steve Atkins <steve(at)blighty(dot)com>
To: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Accessing Database Data from C Function
Date: 2006-08-10 04:08:30
Message-ID: 95DF46DD-CE9E-4906-BEB7-05F0DA56E69C@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Aug 8, 2006, at 8:33 PM, Jeffrey Bigham wrote:

>
>> Do you have a reason to use C instead of a higher-level language?
>
> 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?

It depends on what you're doing. I've found plpgsql to be a better
match for a lot of purposes, as it has a much better "impedance
match" with the database. I'm a happy C hacker, and use C for
PG functions where it seems appropriate, but use plpgsql for
>90% of my in database work. Performance is probably marginally
slower than C, but development time for day-to-day triggers and
functions is a lot faster. Much easier to maintain, too.

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-08-10 04:57:07 Re: Connection string
Previous Message Tom Lane 2006-08-10 04:06:05 Re: Too many open files from postgres.