Re: Which is faster SQL or PL/PGSQL

From: Joe Conway <mail(at)joeconway(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: 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 17:24:19
Message-ID: 3F941A43.1040802@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Richard Huxton wrote:
> So - gain by not re-planning on every call, but maybe lose because your plan
> is not so precise.
>
> Of course, any queries you build dynamically and run via EXECUTE will have to
> be planned each time.
>

This question gets even more complex in 7.4, where many simple SQL
functions will get inlined, and library preloading is available to speed
that first PL/pgSQL call.

I think the best way to answer this question for any particular function
is to try it both ways (if the function *can* be written as a SQL
function) and see for yourself. And if you do this in 7.3, redo it when
you upgrade to 7.4.

HTH,

Joe

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-10-20 17:49:19 Re: Which is faster SQL or PL/PGSQL
Previous Message Richard Huxton 2003-10-20 17:23:14 Re: Scripting only the functions