Re: statement caching proof of concept
От | till toenges |
---|---|
Тема | Re: statement caching proof of concept |
Дата | |
Msg-id | 44972EB9.8060508@kyon.de обсуждение исходный текст |
Ответ на | Re: statement caching proof of concept (till toenges <tt@kyon.de>) |
Список | pgsql-jdbc |
till toenges wrote: > The current situation allows to use a prepared statement from several > threads at once, or more than once before reading the result in a single > thread. There is no way to get all the results back reliably in this > case. Since the JDBC specifications don't demand anything more (afaik), > solution 1 seems ok. Oversight on my part: If the caching is automatic, an application that originally used several prepared statements with the same sql and now gets only one from the cache would very probably misbehave. Therefore "just allowing it" is not an option. In fact, i have no precise idea how a statement would know that it is ready for reuse. An application could keep a reference to the statement and run it again and again. WeakReferences and ReferenceQueues could be used. Always interesting to play with the garbage collector ;-) Maybe the postgres api has a way to identify individual calls and then Mark Lewis idea of just caching the handle and creating individual prepared statement objects upon use is the right way to go. Till
В списке pgsql-jdbc по дате отправления: