Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: What language is faster, C or PL/PgSQL?

4 views
Skip to first unread message

Carlo Stonebanks

unread,
Feb 2, 2013, 12:36:04 PM2/2/13
to

Here is an advantage Plpgsql has: http://www.postgresql.org/docs/9.1/static/plpgsql-expressions.html

 

I guess you can offset this by creating your own prepared statements in C. Otherwise, I can’t think of how C could be slower. I would choose C for functions that don’t have SQL statements in them – e.g. math and string processing.

 

From: pgsql-gen...@postgresql.org [mailto:pgsql-gen...@postgresql.org] On Behalf Of Karel Riverón Escobar
Sent: February 2, 2013 10:42 AM
To: pgsql-...@postgresql.org
Subject: [GENERAL] What language is faster, C or PL/PgSQL?

 

Hi people,

I need to write an algorithm for processing large amounts of data. I want to write a function on PgAdmin 3 to solve my problem. I need to know what language should be used, C or PL/PgSQL?

Needless to say, what I need is quickly. What language is faster, C or PL/PgSQL?

 

Greetings, Karel Riverón
University of Informatics Science

Ovnicraft

unread,
Feb 2, 2013, 12:04:46 PM2/2/13
to
On Sat, Feb 2, 2013 at 10:42 AM, Karel Riverón Escobar <kesc...@estudiantes.uci.cu> wrote:
Hi people,

I need to write an algorithm for processing large amounts of data. I want to write a function on PgAdmin 3 to solve my problem. I need to know what language should be used, C or PL/PgSQL?

Needless to say, what I need is quickly. What language is faster,
C or PL/PgSQL?

Hello, performance processing data is not 100% related to language, IMO is more related with algorithm.
You need to check your algorithm and order.

Answering your question i suggest you C could be some ugly but will be faster, in this point could be good read an opinion from any PG hacker.

Regards,

Greetings, Karel Riverón
University of Informatics Science





--
Cristian Salamea
@ovnicraft

Karel Riverón Escobar

unread,
Feb 2, 2013, 10:42:04 AM2/2/13
to
Hi people,

I need to write an algorithm for processing large amounts of data. I want to write a function on PgAdmin 3 to solve my problem. I need to know what language should be used, C or PL/PgSQL?

Needless to say, what I need is quickly. What language is faster,
C or PL/PgSQL?

Merlin Moncure

unread,
Feb 4, 2013, 9:33:02 AM2/4/13
to
On Sat, Feb 2, 2013 at 11:36 AM, Carlo Stonebanks
<stonec....@sympatico.ca> wrote:
> Here is an advantage Plpgsql has:
> http://www.postgresql.org/docs/9.1/static/plpgsql-expressions.html
>
> I guess you can offset this by creating your own prepared statements in C.
> Otherwise, I can’t think of how C could be slower. I would choose C for
> functions that don’t have SQL statements in them – e.g. math and string
> processing.

For cases involving data processing (SPI calls), C can be slower
because pl/pgsql has a lot of optimizations in it that can be very
easy to miss. I don't suggest writing backend C functions at all
unless you are trying to interface with a C library to access
functionality currently not exposed in SQL.

merlin


--
Sent via pgsql-general mailing list (pgsql-...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

0 new messages