pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: till toenges <tt@kyon.de>
To: List <pgsql-jdbc@postgresql.org>
Cc: Dave Cramer <pg@fastcrypt.com>
Subject: Re: statement caching proof of concept
Date: Tue, 20 Jun 2006 01:09:45 +0200
Message-ID: <44972EB9.8060508@kyon.de> (raw)
In-Reply-To: <44972AF1.1020009@kyon.de>
References: <4077BF73-482B-46C8-B65D-2E1FD2465294@fastcrypt.com>
	<4496F396.8030408@kyon.de>
	<5A43640B-3C41-4D07-AA9E-588AD8AAD343@fastcrypt.com>
	<44972AF1.1020009@kyon.de>

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



view thread (18+ messages)  latest in thread

Message-ID: <44972EB9.8060508@kyon.de>
Permalink:  ../44972EB9.8060508@kyon.de/
Also on:    postgresql.org/message-id/44972EB9.8060508@kyon.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tt@kyon.de, pg@fastcrypt.com
  Subject: Re: statement caching proof of concept
  In-Reply-To: <44972EB9.8060508@kyon.de>
  References: <4077BF73-482B-46C8-B65D-2E1FD2465294@fastcrypt.com> <4496F396.8030408@kyon.de> <5A43640B-3C41-4D07-AA9E-588AD8AAD343@fastcrypt.com> <44972AF1.1020009@kyon.de> <44972EB9.8060508@kyon.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox