couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wout Mertens <wmert...@cisco.com>
Subject Re: [user] Obtaining unique values from a view
Date Tue, 03 Mar 2009 21:32:00 GMT
On Mar 3, 2009, at 6:00 PM, Chris Anderson wrote:

> On Tue, Mar 3, 2009 at 6:52 AM, Wout Mertens <wmertens@cisco.com>  
> wrote:
>>>> Since this question has been posed more than once, maybe main.js  
>>>> should
>>>> have a uniq() function as well?
>
> Dragons dragons...
>
> This is one pattern Couch does not support (and it is not unique in  
> this way).
[...]
> It's just taking a tall list and making it into a wide list. The
> disadvantage of a wide list is that you have to have the whole thing
> in memory at once. This is where Couch breaks down, because the
> spidermonkey process eventually has to have all the unique rows of the
> map in memory all at once.

Ok I understand, if your value grows for each reduce, you end up with  
a huge value at the last reduce.

However, suppose you keep tags about documents in separate documents,  
you would need uniq() to find out which tags a certain document has,  
no? On the last re-reduce, would the total reduce value size not be at  
most a few times the total amount of tags? So still manageable?

Would the problem be alleviated if you could specify for views that  
couch should not reduce past the group level? In other words, only  
calculate what's needed for views with group=true?


So I suppose that for now, this behavior should not be encouraged by  
providing a uniq() function :-)

Wout.

Mime
View raw message