Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 61043 invoked from network); 30 Jul 2009 07:16:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Jul 2009 07:16:23 -0000 Received: (qmail 4532 invoked by uid 500); 30 Jul 2009 07:16:23 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4455 invoked by uid 500); 30 Jul 2009 07:16:23 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 4444 invoked by uid 99); 30 Jul 2009 07:16:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2009 07:16:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.211.174 as permitted sender) Received: from [209.85.211.174] (HELO mail-yw0-f174.google.com) (209.85.211.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2009 07:16:13 +0000 Received: by ywh4 with SMTP id 4so513580ywh.17 for ; Thu, 30 Jul 2009 00:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=eppUQJr8qaV0fWT3gdolK60ceUlMtqoT96NhPED5Qqc=; b=jJpstSVGQyKcNbhvORfatOyZEjgNF0VT31n+npQuJ3NiAo3Rs5GPa7kS+a421gOs3e Pxh98aOCfYKVGUylmc++OTPsqRk51d86ZzIwzblAna+YACce96eqgX9EQRhII58mZOBy uMuEwpmECpRVup7r0Bt6k+82p5cfrFGJDK/KY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=REzpd0rn0NJM6psskEU1ChiARyRQoram1l33RtS1SKdZwzSBWt5jhdFLiUMLObqi8L ieCZSytg8Ukqp0DcWRY5IADAslOqldDy8onssxAyRWlx7r6M3BjlgFxhpI30tOrdSJpq 2nxEDLpAaJNRMHpdGN/2N/cVEsE7fj5Fxh1Wg= MIME-Version: 1.0 Received: by 10.100.107.20 with SMTP id f20mr1112941anc.14.1248938152991; Thu, 30 Jul 2009 00:15:52 -0700 (PDT) In-Reply-To: <2fd53c3a0907292353g78c72f9ao99d08b9f484ce97b@mail.gmail.com> References: <2fd53c3a0907291738yffc7f1btedebacc201d7644a@mail.gmail.com> <2fd53c3a0907291816x7e6f60dfl5670eb73a24faa31@mail.gmail.com> <2fd53c3a0907292353g78c72f9ao99d08b9f484ce97b@mail.gmail.com> Date: Thu, 30 Jul 2009 03:15:52 -0400 Message-ID: Subject: Re: counting rows in range queries From: Paul Davis To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Jul 30, 2009 at 2:53 AM, Fabio Forno wrote: > On Thu, Jul 30, 2009 at 3:22 AM, Paul Davis wrote: >>> >> >> My bad, that should read 'emit([doc.bucket, doc.date], value)' >> > > Well but it doesn't work either, since when I retrieve the view I get > as many rows as the selected docs, with count 1. Perhaps my > description was confusing, since date is not something like YYMMDD, > but YYMMDDhhmmss. Therefore all the emitted keys are different and the > reduce function can't do any aggregation. > This doesn't matter at all. > This seems to me the case in which the returned total_rows should be > not the number of docs in the view, but instead the actual number of > selected documents. I know that there is a big penalty, however it is > more efficient to let couchdb do it (if the btree implementation is is > good, walking though keys shouldn't be so slow, since consecutive keys > are in the same disk pages) than retrieving everything through the > network. So why not adding a parameter to the view GET for telling > couchdb if it has to count all the documents or not? > Total rows always reflects the number of rows in the view. It can cause some confusion, but the other way around I don't know that it'd cause any less. Also, are you checking the value of the assumed single return row? If you're not getting a single returned row then something is wrong. If you are and it's wrong, then its wrong or I'm wrong. Either way, I'm confused... Paul > -- > Fabio Forno, Ph.D. > Bluendo srl http://www.bluendo.com > jabber id: ff@jabber.bluendo.com >