Re: prepared statement functioning range

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "?? *EXTERN*" <luckyjackgao(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: prepared statement functioning range
Date: 2013-06-14 10:21:43
Message-ID: A737B7A37273E048B164557ADEF4A58B17BB2BA5@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

高健 wrote:
> Prepared statement is only for use in the same session at which it has been executed.
> It can not be shared via multiple sessions.

That is correct, see
http://www.postgresql.org/docs/current/static/sql-prepare.html

> That is, when in some special situations ,
> if I have to use mulitple connections between client applicaiton and postgresql database,
> I must consider this point if I want to get benifit from prepared statements.
>
> So I am now thinking about the reason that prepared statement can not cross over sessions.
> Maybe it is because of MVCC control? So in order to make it simple, the prepared statement is in one
> session range?

Statement plans are kept only per session, so a prepared statement
across multiple transactions would not have any benefits unless
the architecture would be changed to keep cached statement plans
in shared memory (like Oracle has it, which is always a good
source for bugs).

Are there any other benefits do you expect from prepared statements?

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2013-06-14 11:58:24 Re: Why hash join cost calculation need reduction
Previous Message 高健 2013-06-14 08:49:06 prepared statement functioning range