Re: function call vs staright query - Mailing list pgsql-performance

From Vincenzo Romano
Subject Re: function call vs staright query
Date
Msg-id 200703191118.55765.Vincenzo.Romano@gmail.com
Whole thread Raw
In response to Re: function call vs staright query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
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]

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: function call vs staright query
Next
From: Ruben Rubio
Date:
Subject: Vacuum full is slow