Re: function call vs staright query

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: function call vs staright query
Date: 2007-03-19 10:18:55
Message-ID: 200703191118.55765.Vincenzo.Romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Monday 19 March 2007 05:07 Tom Lane wrote:
> Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)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]

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ruben Rubio 2007-03-19 11:02:44 Vacuum full is slow
Previous Message Tom Lane 2007-03-19 04:07:41 Re: function call vs staright query