Re: Which is faster SQL or PL/PGSQL

From: Joe Conway <mail(at)joeconway(dot)com>
To: josh(at)agliodbs(dot)com
Cc: Richard Huxton <dev(at)archonet(dot)com>, Michael Pohl <pgsql(at)newtopia(dot)com>, pgsql-sql(at)postgresql(dot)org, "George A(dot)J" <jinujosein(at)yahoo(dot)com>
Subject: Re: Which is faster SQL or PL/PGSQL
Date: 2003-10-20 18:54:42
Message-ID: 3F942F72.6050709@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus wrote:
>>Yes, I believe so (well, actually the optimizer). An inlined SQL
>>function ends up behaving like a macro that expands at run time and is
>>therefore quite fast -- no function call overhead at all.
>
> ... but only in 7.4. In 7.2 and I think in 7.3 this was not implemented.

Yeah, that's what my original post said ;-)

> While we're on the topic, anyone know any good ways to speed up EXECUTE
> statements in PL/pgSQL functions?

Never tried it, but is it possible to use a prepared statement inside a
PL/pgSQL function? In any case, you can in other PLs. And with library
preloading (starting in 7.4), the first call to other PLs is similar to
that of PL/pgSQL. See:
http://archives.postgresql.org/pgsql-patches/2003-07/msg00239.php

Joe

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-10-20 19:00:31 Re: Which is faster SQL or PL/PGSQL
Previous Message Adam Witney 2003-10-20 18:40:42 Crosstab question