Re: Which is faster SQL or PL/PGSQL - Mailing list pgsql-sql

From Joe Conway
Subject Re: Which is faster SQL or PL/PGSQL
Date
Msg-id 3F941A43.1040802@joeconway.com
Whole thread Raw
In response to Re: Which is faster SQL or PL/PGSQL  (Richard Huxton <dev@archonet.com>)
Responses Re: Which is faster SQL or PL/PGSQL  (Richard Huxton <dev@archonet.com>)
List 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



pgsql-sql by date:

Previous
From: weigelt@metux.de
Date:
Subject: Re: [postgres] PostgreSQL-DB auf Web-Schnittstelle bringen
Next
From: Richard Huxton
Date:
Subject: Re: Scripting only the functions