Skip site navigation (1) Skip section navigation (2)

Re: statement caching proof of concept

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: (view raw, whole thread or download thread mbox)
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.


In response to

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2006-06-19 23:15:48
Subject: Re: statement caching proof of concept
Previous:From: till toengesDate: 2006-06-19 22:53:37
Subject: Re: statement caching proof of concept

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group