Re: 7.3 Prepared statements

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: 7.3 Prepared statements
Дата
Msg-id 1040142712.456.68.camel@tokyo
обсуждение исходный текст
Ответ на 7.3 Prepared statements  (Ericson Smith <eric@did-it.com>)
Ответы Re: 7.3 Prepared statements  (Francisco J Reyes <fran@natserv.net>)
Список pgsql-general
On Tue, 2002-12-17 at 10:19, Ericson Smith wrote:
> 1. What is the lifetime of the plan created?

From the PREPARE reference page:

Prepared queries are stored locally (in the current backend), and only
exist for the duration of the current database session. When the client
exits, the prepared query is forgotten, and so it must be re-created
before being used again. This also means that a single prepared query
cannot be used by multiple simultaneous database clients; however, each
client can create their own prepared query to use.

> 2. If it is for the session, does it last through persistent connections
> (eg. PHP)

Yes -- but as noted above, relying on a prepared query to exist for a
given connection is tricky. At best, you can write your client in such a
way that whenever it EXECUTEs a query it didn't PREPARE itself, it is
capable of issuing the requisite PREPARE statement if the EXECUTE fails.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




В списке pgsql-general по дате отправления:

Предыдущее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: ORDER BY random() LIMIT 1 slowness
Следующее
От: Neil Conway
Дата:
Сообщение: Re: prepared statements and analyze in 7.3