Re: What language is faster, C or PL/PgSQL?
От | Carlo Stonebanks |
---|---|
Тема | Re: What language is faster, C or PL/PgSQL? |
Дата | |
Msg-id | 041001ce0364$dbfbfaa0$93f3efe0$@sympatico.ca обсуждение исходный текст |
Ответ на | Re: What language is faster, C or PL/PgSQL? (Bruce Momjian <bruce@momjian.us>) |
Список | pgsql-general |
If a C function was a call to multiple (unprepared) SQL statements, = could PL/PGSQL's prepare-once plan caching have an advantage? -----Original Message----- From: pgsql-general-owner@postgresql.org = [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Bruce Momjian Sent: February 5, 2013 12:06 AM To: Merlin Moncure Cc: Carlo Stonebanks; kescobar@estudiantes.uci.cu; = pgsql-general@postgresql.org Subject: Re: [GENERAL] What language is faster, C or PL/PgSQL? On Mon, Feb 4, 2013 at 08:33:02AM -0600, Merlin Moncure wrote: > On Sat, Feb 2, 2013 at 11:36 AM, Carlo Stonebanks=20 > <stonec.register@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=20 > > for functions that don t have SQL statements in them e.g. math and = > > string processing. >=20 > For cases involving data processing (SPI calls), C can be slower=20 > because pl/pgsql has a lot of optimizations in it that can be very=20 > easy to miss. I don't suggest writing backend C functions at all=20 > unless you are trying to interface with a C library to access=20 > functionality currently not exposed in SQL. How is PL/pgSQL faster than C? I thought we had optimized PL/pgSQL to = save parsed functions, but I don't see how that would help with queries, = which use SPI. Am I missing something? --=20 Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To = make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
В списке pgsql-general по дате отправления: