Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5ECCA919A for ; Mon, 13 Feb 2012 20:35:52 +0000 (UTC) Received: (qmail 72003 invoked by uid 500); 13 Feb 2012 20:35:52 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 71882 invoked by uid 500); 13 Feb 2012 20:35:51 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 71874 invoked by uid 500); 13 Feb 2012 20:35:51 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 71870 invoked by uid 99); 13 Feb 2012 20:35:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Feb 2012 20:35:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Feb 2012 20:35:50 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 47C0EBDC; Mon, 13 Feb 2012 20:35:30 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Mon, 13 Feb 2012 20:35:30 -0000 Message-ID: <20120213203530.61637.57884@eos.apache.org> Subject: =?utf-8?q?=5BCouchdb_Wiki=5D_Update_of_=22Why_are_all_Views_in_a_single_I?= =?utf-8?q?ndex=22_by_BenjaminYoung?= Auto-Submitted: auto-generated Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for c= hange notification. The "Why are all Views in a single Index" page has been changed by Benjamin= Young: http://wiki.apache.org/couchdb/Why%20are%20all%20Views%20in%20a%20single%20= Index Comment: initial text by Filipe Manana New page: =3D Why are all Views in a single Index =3D by [[http://fdmanana.wordpress.com/|Filipe Manana]] Each view basically corresponds to 1 btree. All live in the same file. Othe= r than saving the number of file descriptors and possibly, some OS page cac= hing benefits, and simpler code, I don't think there's more benefits. Now the real benefit comes when in the same ddoc you have 2 (or more) views= with the same map function. For example: {{{ view1: { "map": "function(doc) { if (doc.type =3D=3D=3D 'foo') { emit(key, value); } }", "reduce": "_count" } }}} {{{ view2: { "map": "function(doc) { if (doc.type =3D=3D=3D 'foo') { emit(key, value); } }", "reduce": "_sum" } }}} Here view1 and view2 have exactly the same map function. Would they be in d= ifferent ddocs, we would have 2 btrees (in 2 different files) for exactly t= he same data. Now, if they're in the ddoc, we use 1 btree only but with 2 d= ifferent reduce values - this saves disk space and update time (1 only upda= te 1 btree instead of 2) - of course, this is easy only because we use 1 si= ngle file for a ddoc with multiple views.