Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 68027 invoked from network); 29 Jun 2009 14:02:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jun 2009 14:02:02 -0000 Received: (qmail 72482 invoked by uid 500); 29 Jun 2009 14:02:12 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 72393 invoked by uid 500); 29 Jun 2009 14:02:11 -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 72370 invoked by uid 99); 29 Jun 2009 14:02:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jun 2009 14:02:11 +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; Mon, 29 Jun 2009 14:02:08 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6122D234C052 for ; Mon, 29 Jun 2009 07:01:47 -0700 (PDT) Message-ID: <335682984.1246284107397.JavaMail.jira@brutus> Date: Mon, 29 Jun 2009 07:01:47 -0700 (PDT) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-3498) Performance sensitive to FROM order list in three way join with GROUP BY In-Reply-To: <798550811.1204746100809.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-3498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dag H. Wanvik updated DERBY-3498: --------------------------------- Derby Categories: [Performance] > Performance sensitive to FROM order list in three way join with GROUP BY > ------------------------------------------------------------------------ > > Key: DERBY-3498 > URL: https://issues.apache.org/jira/browse/DERBY-3498 > Project: Derby > Issue Type: Bug > Components: SQL > Reporter: Daniel John Debrunner > Priority: Minor > > The Order Entry system test has this query in Checks.testCondition2(): > SELECT D.D_ID, D.D_W_ID,D.D_NEXT_O_ID, > MAX(O.O_ID),MAX(N.NO_O_ID) FROM NEWORDERS N, > DISTRICT D, ORDERS O WHERE D.D_W_ID=O.O_W_ID > AND D.D_W_ID = N.NO_W_ID AND D.D_ID = O.O_D_ID > AND D.D_ID = N.NO_D_ID GROUP BY > D.D_ID,D.D_W_ID,D.D_NEXT_O_ID > Changing the FROM list to put DISTRICT first reduced the running time from ~138seconds to ~105 and a similar reduction on another machine. > (with a 1 warehouse database) > Beyond that, the query seems to take too long. 10 rows will be returned and for each district row (returned row) the MAX() values in the select list should just be a max lookup in the primary key for the ORDERS and NEWORDERS table. The primary key for these tables is W_ID, D_ID, O_ID. > Thus it should be a scan of the 10 row DISTRICT table with 20 index lookups, hard to see how that should table 100 seconds. > One can see this by using the java-system-mini-codeline-jars target. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.