Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 79901 invoked from network); 28 Oct 2008 16:43:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Oct 2008 16:43:27 -0000 Received: (qmail 41526 invoked by uid 500); 28 Oct 2008 16:43:31 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 41191 invoked by uid 500); 28 Oct 2008 16:43:30 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 41180 invoked by uid 99); 28 Oct 2008 16:43:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2008 09:43:30 -0700 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 ara.t.howard@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2008 16:42:14 +0000 Received: by nf-out-0910.google.com with SMTP id c7so1326207nfi.40 for ; Tue, 28 Oct 2008 09:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=x9DQ2bMyppsSE8CMU/edFwlANfOO9hi4MJcF5tfdhCk=; b=Eu4Xgas9kOxAcRs37KtOJQAUkP1kFe674lcPhawEkk6tYSYc7uQ6qJ40svXs5HKnS4 A0RDXTn3faDi1JiEMWZVxZSp/dfS9MIb6Kn1zFVO+rHazE+uEX7SPBk1I1EIKeNMgGnq Oek37BTmgAJ4faDnAYaUoOq5ctgT7khVOGc28= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=IQSGqygzh64nXw+l7B3tOE1h1lVjJJPJg/4Ks+XuXVYOo/SV7Wlem9nzNsQ6LRigy9 4TYttmeI40RPfZd6LVoZmlcLPzY9EmCbL0LkCqEKvZ8M3IRCklx9W5lCG5/8Ti3XxJRW Ya7Kzx8KUXxSADzanwnFKmRPzoq3oNY7E3UKE= Received: by 10.210.79.14 with SMTP id c14mr8571307ebb.194.1225212172989; Tue, 28 Oct 2008 09:42:52 -0700 (PDT) Received: from ?192.168.0.3? ([65.103.96.46]) by mx.google.com with ESMTPS id 5sm2528923eyf.8.2008.10.28.09.42.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 09:42:52 -0700 (PDT) Message-Id: <0DBC1B8C-787A-46C8-B530-F418A78173A3@gmail.com> From: "ara.t.howard" To: couchdb-user@incubator.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: Thinking outside the RDBMS box - how do I... ? Date: Tue, 28 Oct 2008 10:42:47 -0600 References: <9a60b7b50810280834m3f0c662u139f24bd439202ad@mail.gmail.com> X-Mailer: Apple Mail (2.929.2) X-Virus-Checked: Checked by ClamAV on apache.org On Oct 28, 2008, at 10:17 AM, Chris Anderson wrote: > When a message comes from a phone, create a document like so: > > { > "_id":"0b3a963dc37079652fa3092223be35b5", > "_rev":"1805961941", > "message" : "hey all this is the message", > "phone": "971 555-1212", > "time": "2008/06/30 06:30:35 +0000" > } > > this document would never need to be updated, except in the case of > deletion. > > Also maintain docs for groups, eg: > > { > "_id":"0b3a963dc37079652fa3092223be35b5", > "_rev":"1805961941", > "group" : "a group can have a title", > "phones": ["971 555-1212","818 555-1212", "503 555-1212", "512 > 555-1212"], > } > > Then to load all the messages from phones in a group, GET the group > document, then run a multi-key request against a map view of the > messages, which is keyed by phone number. You have the whole thing in > 2 requests. the issue i see with that, and with any approach that requires a mutli document design with couch, is how to perform multi doc updates. take the above and imagine someone changes their phone number, getting all the messages and updating them, along with any group documents, is very error prone as it consumes a ton of read/write pairs during which any failure of the system could leave the db in an inconsistent state. this applies to the more mundane task of just making a tweak to the data too - like say we realized our code was appending 1+ for domestic numbers and shouldn't have been.... i guess the more general issue is that, with couch, keep denormalized data like this (the phone number) is problematic since there is not way to update it with acid properties. having said that this does seem like a great application for couch. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama