From: | till toenges <tt(at)kyon(dot)de> |
---|---|
To: | List <pgsql-jdbc(at)postgresql(dot)org> |
Cc: | Dave Cramer <pg(at)fastcrypt(dot)com> |
Subject: | Re: statement caching proof of concept |
Date: | 2006-06-19 23:09:45 |
Message-ID: | 44972EB9.8060508@kyon.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2006-06-19 23:15:48 | Re: statement caching proof of concept |
Previous Message | till toenges | 2006-06-19 22:53:37 | Re: statement caching proof of concept |