incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: Need advice about docs structure design.
Date Thu, 17 Jun 2010 23:01:24 GMT

On Jun 17, 2010, at 1:37 PM, faust 1111 wrote:

> If i keep  them in the same database
> What about view speed?
> 
> Example users add many bookmarks and when try fetch Posts each
> bookmark processed by this view but it's unnecessary it's slow down my
> views is not it?.
> 

views are processed in batch, so all functions in a design doc are calculated together. so
don't worry about having lots of views.

still, it helps to keep views compact, so only emit what you need from each view, even if
you have many views. (I break this rule all the time).

mostly, relax about how to store it, and the just write whatever views get you want you need.

Chris

> 
> 2010/6/18 J Chris Anderson <jchris@gmail.com>:
>> 
>> On Jun 17, 2010, at 1:15 PM, faust 1111 wrote:
>> 
>>> Hy guy's.
>>> 
>>> My model:
>>> Users has
>>>  Bookmarks and Posts
>>> 
>>> have idea keep Bookmarks and Posts in separate DB (for speed views).
>>> But in view i want fetch Bookmarks and Posts with user name,
>>> 
>> 
>> You should keep them in the same database (replication is easier, too) and then use
this kind of query:
>> 
>> http://www.cmlenz.net/archives/2007/10/couchdb-joins
>> 
>>> In what way i can do this?
>>> keep copy of users in each DB?
>>> 
>>> or may be keep users in separate DB, fetch bookmarks or posts and then
>>> fetch users and then merge?
>>> 
>>> Yes i know i can copy user name to doc, but have a trouble when user
>>> name is changed (it's force me use stale=ok in request view
>>> +background process to track changes and run rebuild index).
>>> 
>>> I think it's will be cool crazy stuff if i can update docs(cached
>>> fields - not have effect to index) and say Couch you don't need
>>> rebuild index relax ;).
>>> 
>>> Any advice?
>> 
>> 


Mime
View raw message