Re: prepared statement functioning range - Mailing list pgsql-general

From Albe Laurenz
Subject Re: prepared statement functioning range
Date
Msg-id A737B7A37273E048B164557ADEF4A58B17BB2BA5@ntex2010a.host.magwien.gv.at
Whole thread Raw
In response to prepared statement functioning range  (高健 <luckyjackgao@gmail.com>)
List 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

pgsql-general by date:

Previous
From: 高健
Date:
Subject: prepared statement functioning range
Next
From: Stephen Frost
Date:
Subject: Re: Why hash join cost calculation need reduction