Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 1924 invoked from network); 11 Feb 2009 18:48:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 18:48:04 -0000 Received: (qmail 2260 invoked by uid 500); 11 Feb 2009 18:48:02 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 2221 invoked by uid 500); 11 Feb 2009 18:48:02 -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 2210 invoked by uid 99); 11 Feb 2009 18:48:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 10:48:02 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.132.251 as permitted sender) Received: from [209.85.132.251] (HELO an-out-0708.google.com) (209.85.132.251) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 18:47:54 +0000 Received: by an-out-0708.google.com with SMTP id c37so170092anc.5 for ; Wed, 11 Feb 2009 10:47:33 -0800 (PST) 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=sGs5A6kNM7roboeQTuTKcHC3zKNYJR0CU6nau1VFCfQ=; b=elItD4NmWt/p/bP3Egbpy5HhBnhfFQu+ius2kFWuUW5zqjaOKcDQpkYoNQGWjWi9HA Ex8g78Ezq9xZIYC7urS6dMtIVjeeUcWIMfZ33xSZqk3rDvbhEHyiDGh09Czr4dFTY1NJ /NN5+/4Xf2hjiQbIhbDjtPwGHbjLXdF35UyoQ= 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=jdtuNzcuALSyDctMreu78Z4crL91LiIq9l0Ww4q0MwQGPqNeCKyS7wqNFBV2XNWjlj NpCvUvaRQuzc7wpvMYaLaCVdtaybd5llkPM2I6JWB+rDfSiyVLXS4O3nWAqk3Dp25IFi QSLuLHIeXRNppdyfe8mAFSDs6wQSCN1rggmSk= MIME-Version: 1.0 Received: by 10.100.111.5 with SMTP id j5mr3635404anc.54.1234378053538; Wed, 11 Feb 2009 10:47:33 -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:47:33 -0500 Message-ID: Subject: Re: [user] Thoughts on document/views... 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 Wed, Feb 11, 2009 at 1:28 PM, Wout Mertens wrote: > On Feb 11, 2009, at 7:22 PM, kowsik wrote: > >> Just something that occurred to me and wanted to run it by you guys. >> For pcapr, I have a number of different types of documents in >> couch-db, some are comments, some are about the packets, etc. Now, I >> have views that do something like this: >> >> map: function(doc) { >> if (doc.type == 'comment') emit(...); >> } >> >> With a large set of documents and a large set of views, any new >> document or updates to document is passed to __all__ of the views >> (when the view is eventually invoked). But I "know" that my documents >> come in classes and that only certain views really apply to them. I'm >> thinking of a view as a static method on a class that gets some >> information about the instances. >> >> 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? > > Also, once a view is run on a document, it doesn't get re-run that often > does it? > > So other than eating diskspace, maybe there's not really anything wrong with > keeping everything in one db. > > Wout. > > There's nothing at all wrong with keeping lots of multiple document types in a single database. 1 db != 1 table etc etc. When a view is rerun it is only executed once for each document that changed. It doesn't matter how many times the document changed either. HTH, Paul Davis