Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 69425 invoked from network); 11 Aug 2009 10:19:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Aug 2009 10:19:38 -0000 Received: (qmail 12387 invoked by uid 500); 11 Aug 2009 10:19:45 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 12313 invoked by uid 500); 11 Aug 2009 10:19:45 -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 12305 invoked by uid 99); 11 Aug 2009 10:19:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 10:19:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 10:19:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C67BE234C004 for ; Tue, 11 Aug 2009 03:19:14 -0700 (PDT) Message-ID: <1749856565.1249985954811.JavaMail.jira@brutus> Date: Tue, 11 Aug 2009 03:19:14 -0700 (PDT) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4346) LIKE with parameter recomputes greaterEqualString and lessThanString way too often In-Reply-To: <2005913158.1249985834828.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-4346: -------------------------------------- Description: I profiled a 7-way join (the exact query can be found here: http://src.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/history/JDBCHistoryCache_queries.properties?r=809%3Abdef8b63f333#82 ) and saw that 40% of the time was spent in Like.greaterEqualStringFromParameterWithEsc() and Like.lessThanStringFromParameterWithEsc(). These methods are used to generate "x >= greaterEqualString" and "x < lessThanString" clauses that enable a "LIKE ?" clause to make use of indexes. Since the value of the ? parameter is constant throughout a single execution of the statement, it should only be necessary to invoke these methods once per LIKE clause per execution. They are clearly called more frequently for the query in question, and reducing the number of invocations to one per execution would probably make the query execute almost twice as fast. was: I profiled a 7-way join (the exact query can be found here: http://src.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/history/JDBCHistoryCache_queries.properties?r=809%3Abdef8b63f333#82) and saw that 40% of the time was spent in Like.greaterEqualStringFromParameterWithEsc() and Like.lessThanStringFromParameterWithEsc(). These methods are used to generate "x >= greaterEqualString" and "x < lessThanString" clauses that enable a "LIKE ?" clause to make use of indexes. Since the value of the ? parameter is constant throughout a single execution of the statement, it should only be necessary to invoke these methods once per LIKE clause per execution. They are clearly called more frequently for the query in question, and reducing the number of invocations to one per execution would probably make the query execute almost twice as fast. Another attempt to make the URL clickable... > LIKE with parameter recomputes greaterEqualString and lessThanString way too often > ---------------------------------------------------------------------------------- > > Key: DERBY-4346 > URL: https://issues.apache.org/jira/browse/DERBY-4346 > Project: Derby > Issue Type: Improvement > Components: SQL > Affects Versions: 10.5.1.1 > Reporter: Knut Anders Hatlen > > I profiled a 7-way join (the exact query can be found here: http://src.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/history/JDBCHistoryCache_queries.properties?r=809%3Abdef8b63f333#82 ) and saw that 40% of the time was spent in Like.greaterEqualStringFromParameterWithEsc() and Like.lessThanStringFromParameterWithEsc(). > These methods are used to generate "x >= greaterEqualString" and "x < lessThanString" clauses that enable a "LIKE ?" clause to make use of indexes. Since the value of the ? parameter is constant throughout a single execution of the statement, it should only be necessary to invoke these methods once per LIKE clause per execution. They are clearly called more frequently for the query in question, and reducing the number of invocations to one per execution would probably make the query execute almost twice as fast. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.