pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Richard Huxton <dev@archonet.com>
Cc: Michael Pohl <pgsql@newtopia.com>
Cc: pgsql-sql@postgresql.org, "George A.J" <jinujosein@yahoo.com>
Subject: Re: Which is faster SQL or PL/PGSQL
Date: Mon, 20 Oct 2003 10:24:19 -0700
Message-ID: <3F941A43.1040802@joeconway.com> (raw)
In-Reply-To: <200310201809.51830.dev@archonet.com>
References: <Pine.LNX.4.44.0310201119240.10378-100000@server1.techplant.com>
	<200310201809.51830.dev@archonet.com>

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




view thread (13+ messages)  latest in thread

Message-ID: <3F941A43.1040802@joeconway.com>
Permalink:  ../3F941A43.1040802@joeconway.com/
Also on:    postgresql.org/message-id/3F941A43.1040802@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, dev@archonet.com, pgsql@newtopia.com, jinujosein@yahoo.com
  Subject: Re: Which is faster SQL or PL/PGSQL
  In-Reply-To: <3F941A43.1040802@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox