Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C5971176D for ; Tue, 3 Jun 2014 21:19:37 +0000 (UTC) Received: (qmail 52693 invoked by uid 500); 3 Jun 2014 21:19:33 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 52619 invoked by uid 500); 3 Jun 2014 21:19:33 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 52608 invoked by uid 99); 3 Jun 2014 21:19:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2014 21:19:33 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yseeley@gmail.com designates 209.85.128.169 as permitted sender) Received: from [209.85.128.169] (HELO mail-ve0-f169.google.com) (209.85.128.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2014 21:19:29 +0000 Received: by mail-ve0-f169.google.com with SMTP id jx11so7817463veb.28 for ; Tue, 03 Jun 2014 14:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=GxXrN8k6Roe/SaULt2dSgB43Oj6fQ8sR7FkPZMiovGg=; b=lb044iyFUwN1Rnkg91cu2RrnYLZwDGjdqT1CYLnOvx4ia0aDGtUGh4wGC1WbsF8Aaa KOGCUhw6c46QYbMEpcf/jZD2Cwg6wuw6zKLogh+AYNcuTc4V5qHIf0q8LgFgIzqMkIIy yhH53Evq8yXsp/w36T9//uh6Vu7+lM18LyEQrJB3YaFq67H5UCxVyMMWimZpejVGhOx/ ROJQpDC0ujsEWt4fXcz7v3JclfBrpMBuOM+7znpGdnoT6O/bc6GfcBOZUzWz7n6sHqD5 5AzAX35XcfufN/zYn1YC3sTAKrTMXZmBmNHuxGVua7f9iXV2atH6R3gPLcZdvQMKC7nf SPBQ== MIME-Version: 1.0 X-Received: by 10.52.117.237 with SMTP id kh13mr94777vdb.96.1401830348670; Tue, 03 Jun 2014 14:19:08 -0700 (PDT) Sender: yseeley@gmail.com Received: by 10.58.247.193 with HTTP; Tue, 3 Jun 2014 14:19:08 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Jun 2014 17:19:08 -0400 X-Google-Sender-Auth: p1x1UXwmgk0k97iZID3GU3InR_M Message-ID: Subject: Re: Is the act of *caching* an fq very expensive? (seems to cost 4 seconds in my example) From: Yonik Seeley To: "solr-user@lucene.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Jun 3, 2014 at 4:44 PM, Brett Hoerner wrot= e: > If I run a query like this, > > fq=3Dtext:lol > fq=3Dcreated_at_tdid:[1400544000 TO 1400630400] > > It takes about 6 seconds. Following queries take only 50ms or less, as > expected because my fqs are cached. > > However, if I change the query to not cache my big range query: > > fq=3Dtext:lol > fq=3D{!cache=3Dfalse}created_at_tdid:[1400544000 TO 1400630400] > > It takes 2 seconds every time, which is a much better experience for my > "first query for that range." > > What's odd to me is that I would expect both of these (first) queries to > have to do the same amount of work, expect the first one stuffs the > resulting bitset into a map at the end... which seems to have a 4 second > overhead? They are not equivalent. Caching the filter separately (so it can be reused in any combination with other queries and filters) means that *all* docs that match the filter are collected and cached (it's the collection that is taking the time). For the {!cache=3Dfalse} case, Solr executes different code (it doesn't just skip the caching step). http://heliosearch.org/advanced-filter-caching-in-solr/ """When a filter isn=E2=80=99t generated up front and cached, it=E2=80=99s = executed in parallel with the main query. First, the filter is asked about the first document id that it matches. The query is then asked about the first document that is equal to or greater than that document. The filter is then asked about the first document that is equal to or greater than that. The filter and the query play this game of leapfrog until they land on the same document and it=E2=80=99s declared a match, aft= er which the document is collected and scored.""" So try: q=3D*:* fq=3Dcreated_at_tdid:[1400544000 TO 1400630400] -Yonik http://heliosearch.org - facet functions, subfacets, off-heap filters&field= cache