Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 97962 invoked from network); 31 Jan 2009 21:01:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2009 21:01:26 -0000 Received: (qmail 34585 invoked by uid 500); 31 Jan 2009 21:01:25 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 33995 invoked by uid 500); 31 Jan 2009 21:01:24 -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 33984 invoked by uid 99); 31 Jan 2009 21:01:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jan 2009 13:01:24 -0800 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of b.candler@pobox.com designates 208.72.237.25 as permitted sender) Received: from [208.72.237.25] (HELO sasl.smtp.pobox.com) (208.72.237.25) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jan 2009 21:01:14 +0000 Received: from localhost.localdomain (unknown [127.0.0.1]) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 97E762A2C0 for ; Sat, 31 Jan 2009 16:00:50 -0500 (EST) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 42A8D2A2BD for ; Sat, 31 Jan 2009 16:00:50 -0500 (EST) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1LTMxM-0003R0-MW for user@couchdb.apache.org; Sat, 31 Jan 2009 21:00:48 +0000 Date: Sat, 31 Jan 2009 21:00:48 +0000 From: Brian Candler To: user@couchdb.apache.org Subject: Re: Incremental map/reduce Message-ID: <20090131210048.GA12190@uk.tiscali.com> References: <20090130101859.GA7348@uk.tiscali.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: 3D9572CA-EFDA-11DD-B750-F63E8D1D4FD0-28021239!a-sasl-quonix.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Jan 30, 2009 at 10:32:15AM -0800, Chris Anderson wrote: > Once you understand how normal reduce queries (with group=false) work, > eg: those that return a single reduction value for whatever key-range > you specify, group_level queries are not more complex. Group_level > queries are essentially a macro, which run one normal (group=false) > reduce query automatically for each interval on a set of intervals as > defined by the level. Ah - it was new to me that map/reduce queries with group=false could run over arbitary key intervals: $ kurl 'http://localhost:5984/maptest/_view/test/sum' {"rows":[{"key":null,"value":45}]} $ kurl 'http://localhost:5984/maptest/_view/test/sum?startkey="doc3"' {"rows":[{"key":null,"value":42}]} $ kurl 'http://localhost:5984/maptest/_view/test/sum?startkey="doc3"&endkey="doc5"' {"rows":[{"key":null,"value":33}]} This means that couchdb *must* be performing the reduce part of the query on-demand, as opposed to keeping precomputed values stored like the map part. In SQL terms, this is like "count(*)" doing an index scan, rather than having the answer precomputed in a materialised view. And suddenly the various forms of reduce make much more sense. However at http://damienkatz.net/2008/02/incremental_map.html it says: "This requirement of reduce functions allows CouchDB to store off intermediated reductions directly into inner nodes of btree indexes, and the view index updates and retrievals will have logarithmic cost. It also allows the indexes to be spread across machines and reduced at query time with logarithmic cost." Is storing the reductions a planned future feature, rather than describing how it works today? Sorry to keep asking, but I'm going to try to update the wiki in as accurate a way as I can. Thanks, Brian.