pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vincenzo Romano <vincenzo.romano@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: function call vs staright query
Date: Mon, 19 Mar 2007 11:18:55 +0100
Message-ID: <200703191118.55765.Vincenzo.Romano@gmail.com> (raw)
In-Reply-To: <21145.1174277261@sss.pgh.pa.us>
References: <200703180750.54703.Vincenzo.Romano@gmail.com>
	<200703180812.49164.Vincenzo.Romano@gmail.com>
	<21145.1174277261@sss.pgh.pa.us>

On Monday 19 March 2007 05:07 Tom Lane wrote:
> Vincenzo Romano <vincenzo.romano@gmail.com> writes:
> > How can I delay the query planner decisions until the actual query is to
> > be done inside the function body?
>
> Use plpgsql's EXECUTE.  AFAIR there is no way in a SQL-language function.
>
> 			regards, tom lane

The body of a function is *always* treated by the planner as if it were a
dynamically created query. The fact we all use the "$$"s (or also the 's)
around the function body tells it all.

The PREPARE requires every session to do it upon connections, because prepared
statements are managed on a per-session basis.

What I don't understand is why the planner gets passed by during those
queries while it is at full steam during the "normal" queries.
But this could be due to my ignorance! :-)

-- 
Vincenzo Romano
----
Maybe Computers will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1987]



view thread (4+ messages)

Message-ID: <200703191118.55765.Vincenzo.Romano@gmail.com>
Permalink:  ../200703191118.55765.Vincenzo.Romano@gmail.com/
Also on:    postgresql.org/message-id/200703191118.55765.Vincenzo.Romano@gmail.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-performance@postgresql.org
  Cc: vincenzo.romano@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: function call vs staright query
  In-Reply-To: <200703191118.55765.Vincenzo.Romano@gmail.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