Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 30172 invoked from network); 20 Jun 2005 16:16:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2005 16:16:35 -0000 Received: (qmail 63896 invoked by uid 500); 20 Jun 2005 16:16:34 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 63848 invoked by uid 500); 20 Jun 2005 16:16:33 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 63814 invoked by uid 99); 20 Jun 2005 16:16:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 09:16:33 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=UPPERCASE_25_50 X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.42.14] (HELO nwkea-mail-2.sun.com) (192.18.42.14) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 09:16:27 -0700 Received: from phys-mpk-1 ([129.146.11.81]) by nwkea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id j5KGGWFF021347 for ; Mon, 20 Jun 2005 09:16:32 -0700 (PDT) Received: from conversion-daemon.mpk-mail1.sfbay.sun.com by mpk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IIE007014Y75L@mpk-mail1.sfbay.sun.com> (original mail from David.Vancouvering@Sun.COM) for derby-dev@db.apache.org; Mon, 20 Jun 2005 09:16:32 -0700 (PDT) Received: from sun.com (vpn-129-150-30-153.SFBay.Sun.COM [129.150.30.153]) by mpk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IIE00KTX577UG@mpk-mail1.sfbay.sun.com> for derby-dev@db.apache.org; Mon, 20 Jun 2005 09:16:19 -0700 (PDT) Date: Mon, 20 Jun 2005 09:17:12 -0700 From: David Van Couvering Subject: Re: Interesting query In-reply-to: <58D63E44CFC6D3119C8C009027E02DFD08C64593@tlvmail.enigma.co.il> To: Derby Development Message-id: <42B6EC08.2000300@sun.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 References: <58D63E44CFC6D3119C8C009027E02DFD08C64593@tlvmail.enigma.co.il> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, David. Others may want more information, but it seems to me we at least need the DDL for the tables involved in this query. Thanks, David David Zonsheine wrote: > Hello derby-dev, > > Thank you for the wonderful work you're doing. > We installed Derby on our application to be used instead of SQL Server > and worked very hard to improve the queries. > The process results were quite good even though we should improve them > more. > > Now, we have 1 long and complicated query that take 0.04 seconds on SQL > Server and about 25 seconds on Derby. > We worked very hard to improve it but couldn't. > Please take a look at it and see if you have any idea. You'll help us > very very much if you do. > If by any chance you want the DB dump itself I'll be very happy to post it. > > The query is: > > select distinct TN_RT_TOC.TOC_ID, TN_RT_TOC.NODE_ID, > TN_RT_TOC.CHILD_INDEX,TN_RT_TOC.PARENT_NODE_ID, > TN_RT_TOC.NODE_NAME AS TITLE, TN_RT_TOC.NODE_TYPE AS CLASS, > 'Document(docID='|| char(35)|| 'xpointer(id(' || char(36) || > TN_RT_TOC.NODE_LINK || char(36) || ')),storage=REPOSITORY)' AS LINK, > 'Exact' AS LINKTYPE, > 'Document(docID='|| char(35)|| 'xpointer(id(' || char(36) || > TN_RT_TOC.NODE_LINK || char(36) || ')),storage=REPOSITORY)' AS SOURCE_ID, > TN_RT_TOC.NODE_TYPE AS TYPE, TN_RT_TOC.NODE_ID AS PERSISTENTID, > supplement.PROPERTY_VALUE AS NODE_CLASS > FROM > TN_RT_TOC LEFT JOIN TN_RT_TOC_PROPERTI as supplement ON > TN_RT_TOC.TOC_ID=supplement.TOC_ID > AND TN_RT_TOC.NODE_ID=supplement.NODE_ID AND supplement.PROPERTY_VALUE > IN ('JOP', 'Bulletin') > left join TN_RT_TOC_PROPERTI as effectivity on > TN_RT_TOC.TOC_ID=effectivity.TOC_ID > AND TN_RT_TOC.NODE_ID=effectivity.NODE_ID , TAIL_NUMBERS > where > TN_RT_TOC.TOC_ID = 'B767' AND PARENT_NODE_ID = 1 > AND (effectivity.property_name='EFF' OR effectivity.TOC_ID is null) > AND TAIL_NUMBERS.TAIL_NUMBER='JA601J' AND TAIL_NUMBERS.ATTR_NAME='FLEET_EFF' > and TAIL_NUMBERS.ATTR_VALUE>=CASE when effectivity.property_value is not > NULL > then SUBSTR(effectivity.property_value, 1, 3) > ELSE '0' END AND TAIL_NUMBERS.ATTR_VALUE<=CASE when > effectivity.property_value is not NULL > then SUBSTR(effectivity.property_value, 4, 3) ELSE '999' END > order by TN_RT_TOC.CHILD_INDEX > Thank you very much! > David Zonsheine > Projects Development Manager > _www.enigma.com_ > Cell: 972-54-6658784. > > > > > > -------------------------------------------------------------------------------------------------------------------------------------------------------------- > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom > they are addressed. If you have received this email in error please > notify the originator of the message. > Scanning of this message is performed by SurfControl E-mail Filter > software in conjunction with virus detection software.