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 AF1459F9F2D for ; Mon, 19 Jun 2006 20:34:22 -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 15382-03 for ; Mon, 19 Jun 2006 20:34:17 -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 037769F9316 for ; Mon, 19 Jun 2006 20:34:16 -0300 (ADT) Received: (qmail 4320 invoked from network); 19 Jun 2006 23:34:15 -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:34:15 -0000 In-Reply-To: <44973024.4010204@opencloud.com> References: <4077BF73-482B-46C8-B65D-2E1FD2465294@fastcrypt.com> <44973024.4010204@opencloud.com> Mime-Version: 1.0 (Apple Message framework v750) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: List Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: statement caching proof of concept Date: Mon, 19 Jun 2006 19:34:14 -0400 To: Oliver Jowett X-Mailer: Apple Mail (2.750) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/60 X-Sequence-Number: 15340 On 19-Jun-06, at 7:15 PM, Oliver Jowett wrote: > Dave Cramer wrote: >> This is just proof of concept. More work has to be done to make it >> build properly and work properly under different jdk's > > Isn't there a bunch of statement state (things like fetch size, max > rows, etc) that have defined defaults and this cache implementation > will not provide? Good point, these would all have to be reset to their defaults as well. > > The "wrapper" implementation approach suffers from the usual > difficulty that the "back links" such as ResultSet.getStatement() > point to the wrong object. It's actually quite a bit of work to get > this right.. Since result sets only live as long as the statement, wouldn't they point to the statement that is still open ? > > The cached statements are vulnerable to buggy apps that mutate the > statement after close, since there's no interception of those > methods to check whether the wrapper statement has been closed. No question, and I would certainly not make this the default behaviour. The user would have to turn on caching. > > What exactly is the performance bottleneck you're trying to avoid > by having the statement pool? If it's the parse/plan cost, I think > Mark's suggestion of putting the cache at the protocol level may be > simpler. If it's overall statement cost, you might be better off > with a generic wrapper that is not postgresql-specific at all. How does the generic wrapper solve the problems above ? I would think they all suffer from the same problems ? > > -O >