X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A61D99F9316 for ; Mon, 19 Jun 2006 20:59:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 15783-09 for ; Mon, 19 Jun 2006 20:59:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 3AFA89FA667 for ; Mon, 19 Jun 2006 20:59:22 -0300 (ADT) Received: (qmail 4612 invoked from network); 19 Jun 2006 23:59:21 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 19 Jun 2006 23:59:21 -0000 In-Reply-To: <449739C7.2070303@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> <449739C7.2070303@kyon.de> Mime-Version: 1.0 (Apple Message framework v750) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <43EC5E93-607B-46C5-A133-00CE2E58F523@fastcrypt.com> Cc: List Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: statement caching proof of concept Date: Mon, 19 Jun 2006 19:59:20 -0400 To: till toenges X-Mailer: Apple Mail (2.750) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/64 X-Sequence-Number: 15344 Till, Thanks, this is a great example. So how would any caching implementation deal with this? I can think of copying the result set into the wrapper, but that could be prohibitively expensive. Dave On 19-Jun-06, at 7:56 PM, till toenges wrote: > Dave Cramer wrote: >> AFAIK Postgres doesn't allow concurrent statements on the same >> connection, so I don't see how using multiple threads would work ? > > The statements wouldn't need to be concurrent in the sense of > happening > at the same time: > > // stupid query > String sql = "SELECT * FROM quicklychangingtable"; > PreparedStatement p1 = connection.prepareStatement(sql); > PreparedStatement p2 = connection.prepareStatement(sql); > ResultSet r1 = p1.executeQuery(); > // do something else for a while > ResultSet r2 = p2.executeQuery(); > > What happens with r1? Might be ok, but i'm not sure if this is > always true. > > > Till >