From user-return-3489-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Feb 11 21:29:42 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 68902 invoked from network); 11 Feb 2009 21:29:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 21:29:42 -0000 Received: (qmail 53044 invoked by uid 500); 11 Feb 2009 21:29:36 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53012 invoked by uid 500); 11 Feb 2009 21:29:36 -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 53001 invoked by uid 99); 11 Feb 2009 21:29:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 13:29:36 -0800 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 jchris@gmail.com designates 74.125.92.27 as permitted sender) Received: from [74.125.92.27] (HELO qw-out-2122.google.com) (74.125.92.27) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 21:29:28 +0000 Received: by qw-out-2122.google.com with SMTP id 5so110774qwi.29 for ; Wed, 11 Feb 2009 13:29:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=18AGdVTHwAlJnyggRtR3eAb99cvCr8JfbuO8HD0DLLU=; b=YXuvHxCxsTwYrq4PaBadCQckk54uqzLkT7RH2Y2nItZ5ugFPA7+dvd2/XgRgQUWVax SlFYkvsj52eVLD1oiqxf4drB8z0VXKYN7X7IZRLtF5+j2z62hq2Uiv0DK6h+TUA2rfJH NkUWA3syUp3UI71As5G1sRlHl7NU+dksgJ3Qw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=pGoYKu0/5xLd2WgkjLl19ByK7WdRLr6hWp+UPPsxH1oB7QEgy1XKwmXYfdKpeohcuW sx1JGiQscOQQ1lHjxSCx1lyyPLYHLEG0dq30+M0NHDBziMdjQ2N7WD6B8HtVOEoUSsSs W7bVHifJiJ5gf+BLFQhojWrm69rppZc2UOWD0= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.224.20.75 with SMTP id e11mr1190315qab.43.1234387747342; Wed, 11 Feb 2009 13:29:07 -0800 (PST) In-Reply-To: <58546136-8137-45D1-A3EF-D9226C6B26F0@cisco.com> References: <7db9abd30902111022i6c7f6385n23beba458565afb@mail.gmail.com> <58546136-8137-45D1-A3EF-D9226C6B26F0@cisco.com> Date: Wed, 11 Feb 2009 13:29:07 -0800 X-Google-Sender-Auth: 8b27e6c8d62c2740 Message-ID: Subject: Re: [user] Thoughts on document/views... From: Chris Anderson 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 Wed, Feb 11, 2009 at 10:28 AM, Wout Mertens wrote: > On Feb 11, 2009, at 7:22 PM, kowsik wrote: > >> >> What I'm getting at is, does it make sense to have some type of >> document "class" attribute and then have views bound to these classes? >> The goal, of course, being that couch-db can pre-filter a lot of these >> things and only run the views for the appropriate types of documents. > > I'm probably speaking before my turn being such a newbie, but why wouldn't > you create a new database for disjoint classes of documents? That's the basic rule of thumb: Document only need to be in the same database with each other, if they need to be run through the same views (or they need to be replicated together). If you have a db with millions of records, but only a handful of them are interesting to to your views, you will save a lot of serialization by putting the viewed documents in their own database. > > Also, once a view is run on a document, it doesn't get re-run that often > does it? Views are run one per document update, so if you write the document once, it only gets run through the view server once. If you have say, 5 different document "classes" and you have views that care about each of them, if you put those views in the same design document, then you will not have extra serialization hits. Each document update is sent to the view server once per design document. > > So other than eating diskspace, maybe there's not really anything wrong with > keeping everything in one db. My recommendation is to not worry about it, unless you have like 75% or more docs that don't show up in any view. In that case, those docs might better off in another database. Chris -- Chris Anderson http://jchris.mfdz.com