高健 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general