Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 88790 invoked from network); 15 Apr 2009 19:04:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Apr 2009 19:04:15 -0000 Received: (qmail 32841 invoked by uid 500); 15 Apr 2009 19:04:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 32776 invoked by uid 500); 15 Apr 2009 19:04:14 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 32768 invoked by uid 99); 15 Apr 2009 19:04:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Apr 2009 19:04:14 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=MSGID_FROM_MTA_HEADER,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nick.derby@me.com designates 17.148.16.86 as permitted sender) Received: from [17.148.16.86] (HELO asmtpout011.mac.com) (17.148.16.86) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Apr 2009 19:04:06 +0000 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1 Received: from spool004.mac.com ([10.150.69.54]) by asmtp011.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0KI500JNTOXC0B50@asmtp011.mac.com> for derby-dev@db.apache.org; Wed, 15 Apr 2009 12:03:29 -0700 (PDT) Received: from webmail043 ([10.13.128.43]) by spool004.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0KI5006D8OXMFX60@spool004.mac.com> for derby-dev@db.apache.org; Wed, 15 Apr 2009 12:03:22 -0700 (PDT) Date: Wed, 15 Apr 2009 12:03:22 -0700 From: Nick Puz To: derby-dev@db.apache.org Message-id: <157681730964895697200108835802389536937-Webmail@me.com> Subject: Stored Prepared Statements? -- Thoughts on exposing StorablePreparedStatements to user/external statements Received: from [17.226.23.71] from webmail.me.com with HTTP; Wed, 15 Apr 2009 12:03:22 -0700 X-Originating-IP: 17.226.23.71 X-Virus-Checked: Checked by ClamAV on apache.org Hi Derby Developers, I'm evaluating derby for use in the backend of a internet (web+http direct) based service. We have a bunch of mid-tier app server type boxes that all access data mounted on a bunch of nfs filers (so any mid-tier can handle a user request) and so the current thinking is for usage pattern (mimicing what is done in other places in this 5+ year old live system) would be to: 1) lock db directory for user (using symlinks -- atomic nfs op) ... would be done external to derby. 2) open database for the user 3) do operation to satisfy caller's request 4) close db then remove lock. Unfortunately with this usage model the perf benefits of prepared statements go away (parameters still nicer then encoding for string sql stmts). I've done a bit of performance testing and as expected a ton of time is spent preparing a simple primary key lookup query (primarily due to opening/reading the many system tables and few indexes on the table), while the execution goes quite fast. In digging around the code I saw that the statements used for trigger actions are stored to remove this cost on each action invocation, would it be possible to expose this end user statements. In our case a mode that just keeps a persistent cache of the last N statements would be fine, no need to expose at all at the jdbc/sql level. I'm comfortable making the code change but would like to know before embarking on this the thoughts/advice of experienced derby developers. -Nick