Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BAA449D44 for ; Tue, 27 Mar 2012 07:56:09 +0000 (UTC) Received: (qmail 95438 invoked by uid 500); 27 Mar 2012 07:56:09 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 95339 invoked by uid 500); 27 Mar 2012 07:56:09 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 95329 invoked by uid 99); 27 Mar 2012 07:56:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 07:56:09 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of christian.stocker@liip.ch designates 207.126.144.135 as permitted sender) Received: from [207.126.144.135] (HELO eu1sys200aog113.obsmtp.com) (207.126.144.135) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 07:56:00 +0000 Received: from mail-we0-f179.google.com ([74.125.82.179]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKT3FyeYPRtUjuHnlfC6hbY9nPmltR8CPr@postini.com; Tue, 27 Mar 2012 07:55:39 UTC Received: by mail-we0-f179.google.com with SMTP id g1so5730027wer.24 for ; Tue, 27 Mar 2012 00:55:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:organization:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:openpgp :content-type:content-transfer-encoding:x-gm-message-state; bh=hVIJqgqkjVo5sVguEQ0w8qVi8KvYq386z4FJpTIfZDA=; b=OyLt7h3vOW2k9tqVHHH1h0fB2pKhAgRZ5Z65dtYlXz0254NBbdEb6PeGA+d7Bp3rq5 cFdPOd2OA/UKUTW82eKUJjFiwquqKH2/0GeaOz6cWJvke12gITdLhumkyomFVxCXT1h5 dGd5uUacCOw+62d8ICPeMz+F/lzzQ+QjWGateJZjq8uJ8FBdIgN68HQBBmtdESjEWcTU KTR5QrDWLC+XVnd4SC/4/FCd41fDGGpLvyE62/NEkRxRYHLV6ILnGc4z5xUANlannkBC t67RCcbYs22oSQ1pHluG2q+BFRuoO/IK4teFtacrHB9H/w0GayXkww0eDXOxoTnAPkcP w1TA== Received: by 10.216.209.133 with SMTP id s5mr7841358weo.42.1332834937842; Tue, 27 Mar 2012 00:55:37 -0700 (PDT) Received: from air11.local (77-58-253-248.dclient.hispeed.ch. [77.58.253.248]) by mx.google.com with ESMTPS id e6sm47505426wix.8.2012.03.27.00.55.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Mar 2012 00:55:37 -0700 (PDT) Message-ID: <4F717278.7000705@liip.ch> Date: Tue, 27 Mar 2012 09:55:36 +0200 From: Christian Stocker Organization: Liip AG User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120313 Thunderbird/11.0 MIME-Version: 1.0 To: users@jackrabbit.apache.org CC: David Buchmann Subject: Re: Strange Search Performance problem with OR References: <4F70D16E.6090608@liip.ch> <4F716800.7090205@liip.ch> <4F7170F5.8000903@liip.ch> In-Reply-To: <4F7170F5.8000903@liip.ch> X-Enigmail-Version: 1.4 OpenPGP: id=0748D5FE; url=http://gpg-keyserver.de/pks/lookup?op=get&search=0xC2BAFBC30748D5FE Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmBiOenArk6uF01khQ2KiV36gbJZOp4U/RIurYDqsZ9Yburt2oIbhVq/iYfY++cx7SfOj97 X-Virus-Checked: Checked by ClamAV on apache.org Hi On 27.03.12 09:49, David Buchmann wrote: > sorry, my bad. did not read correctly. > you do have the paranthesis so you did what you wanted to do. > > looks like lucene/jackrabbit combine the 2 datasets first and filter > later... > > what if you try > > > SELECT * FROM [own:unstructured] AS data > WHERE > data.guid = 'J7B1X' AND ISDESCENDANTNODE(data, '/article') > OR > data.guid = 'J7B1X' AND ISDESCENDANTNODE(data, '/import/article') > ORDER BY firstImportDate DESC I tried that and I tried it again now. Same response time as the original query. Any hints from someone who knows the internal workings of jackrabbit/lucene? chregu > > if this is fast, then the jackrabbit query engine is not very clever... > > cheers,david > > > Am 27.03.2012 09:10, schrieb David Buchmann: >> i think the 2 queries are not equivalent. the first one is equivalent to > >> ... >> WHERE data.guid = 'J7B1X' >> AND (ISDESCENDANTNODE(data, '/article') > >> plus > >> WHERE >> ISDESCENDANTNODE(data, '/import/article') > >> (if you want the data.guid = ... to apply to both, you need paranthesis) > >> but if /import/article is almost empty, i still don't see why the >> combined query should take so long unless jackrabbit/lucene are doing >> something stupid. > >> cheers,david > >> Am 26.03.2012 22:28, schrieb Christian Stocker: >>> Hi > >>> We have the following search query > > >>> SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X' >>> AND (ISDESCENDANTNODE(data, '/article') >>> OR ISDESCENDANTNODE(data, '/import/article') >>> ) >>> ORDER BY firstImportDate DESC > > >>> This query can take quite some time (up to 3 seconds, but it gets more >>> and more hte more data we have). In /article there's potentially a lot >>> of nodes, in /import/article usually almost nil. > > >>> If we now separate the query into 2: > >>> SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X' >>> AND ISDESCENDANTNODE(data, '/article') >>> ORDER BY firstImportDate DESC > >>> and > >>> SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X' >>> AND ISDESCENDANTNODE(data, '/import/article') >>> ORDER BY firstImportDate DESC > >>> Both queries take approx. 10ms (and return 0 or 1 resultset, more is not >>> possible). So quite fast. > >>> Can anyone explain to me, why that is and how we could rewrite the query >>> to make it fast with a single one as well? > >>> Thanks > >>> chregu > >