Re: Prepared statement already exists

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: Prepared statement already exists
Дата
Msg-id 9f970a3a-6371-4ebf-933f-f1ad2fbdecb4@mm
обсуждение исходный текст
Ответ на Re: Prepared statement already exists  (WireSpot <wirespot@gmail.com>)
Ответы Re: Prepared statement already exists  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-general
    WireSpot wrote:

> So it would eliminate the possibility of clashes, but do nothing for
> statement reuse.

Agreed.

> What would make it all the way better was if the database would do
> that last step for you as well: automatically recognize statements
> that do the same thing and return the already existing handle.

Sure. What I understand from the thread is that you're trying to
emulate in client code what would essentially be a server-side
plan-caching-and-reuse feature. Since it's refered to in the TODO list
(under the entry "Consider automatic caching of statements at various
levels"), I guess this feature doesn't exist in current versions.

Also contrary to prepared statements, maybe that cache would be shared
between connections, and that would be excellent, since it fits the
typical usage pattern of websites: a high-throughput of a small set of
low-latency queries, fired from pooled connections.
Not having the server reparsing and replanning over and over the same
queries can lead to very significant wins in latency, and it doesn't
have to involve any client-side specific code. What the client has to
do however is to use parameterized queries, otherwise the cache gets
polluted with non-reusable statements.

 Best regards,
--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Res: converter pgplsql funcion
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Prepared statement already exists