couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils Breunese <>
Subject RE: filtering on timestamp + aggregation on another field
Date Mon, 14 Mar 2011 18:28:39 GMT
This looks fine to me. To keep the index storage to a minimum I wouldn't store the doc as the
value in the view, but only the absolute minimum you need. Hint: the value can even be null
(which doesn't take a lot of space to store!) and you can use ?include_docs=true to retrieve
the documents with the view query. We use this for almost all of our views, so storage is
mostly going to storing the documents themselves and views add little overhead.

Van: Aroj George []
Verzonden: maandag 14 maart 2011 19:13
Aan:; Kinley Dorji
Onderwerp: Re: filtering on timestamp + aggregation on another field

Thanks for the below.

Another option we came up with is as below,

for each level in the location hierarchy:

which will produce something like the below,

*for given documents:*
{ timestamp : 01/01/2011, location : [India, Maharashtra,Pune] , other_attrs
{ timestamp : 01/02/2011, location : [India, Maharashtra,Mumbai] ,
other_attrs }

*Map output:*
1. [India,01/01/2011], doc
2. [Maharashtra,01/01/2011], doc
3. [Pune,01/01/2011], doc
4. [India,01/02/2011], doc
5. [Maharashtra,01/02/2011], doc
6. [Mumbai,01/02/2011], doc

Now we can have a query like,
startkey=[India,01/01/2011] & endkey=[India,01/03/2011] & group_level=1

which should give me the documents grouped on India but filtered on

The question is, is this a good solution? One concern being the number of
records in the view now is number_of_levels * num_documents
ie in this case 2 documents * 3 levels = 6 records in the view.

Will couch performance suffer with this approach?


View raw message