Re: Prepared statement already exists

Поиск
Список
Период
Сортировка
Искать
От
Daniel Verite
Тема
Re: Prepared statement already exists
Дата
Msg-id
9f970a3a-6371-4ebf-933f-f1ad2fbdecb4@mm
Ответ на
Список
Дерево обсуждения
Prepared statement already exists WireSpot <wirespot@gmail.com>
Re: Prepared statement already exists Sam Mason <sam@samason.me.uk>
Re: Prepared statement already exists WireSpot <wirespot@gmail.com>
Re: Prepared statement already exists Sam Mason <sam@samason.me.uk>
Re: Prepared statement already exists "Merlin Moncure" <mmoncure@gmail.com>
Re: Prepared statement already exists Alvaro Herrera <alvherre@commandprompt.com>
Re: Prepared statement already exists WireSpot <wirespot@gmail.com>
Re: Prepared statement already exists Alvaro Herrera <alvherre@commandprompt.com>
Re: Prepared statement already exists WireSpot <wirespot@gmail.com>
Re: Prepared statement already exists "Albe Laurenz" <laurenz.albe@wien.gv.at>
	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
Дата:
От: Alvaro Herrera
Дата:
FAQ