couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Boniface <>
Subject Grouping a view on a key not provided in the request
Date Fri, 20 Jan 2012 08:11:13 GMT

First of all I apologies if I duplicate my post but I didn't see my mail
from yesterday pop out on the list. So here it is again :)

I am looking into implementing a system that would use as input a high
volume of apaches logs in order to produce reports used on a stats
website (table, graph...). The main requirement is to be low latency as
this is the reason we want to get rid of mysql currently not doing the
job properly.

This lead me to study various nosql databases, but Couch DB was the one
that caught my attention most. It's easy to setup and play with also the
incremental view seemed to really fit my needs. It allowed me to easily
import my existing data and start experimenting with views what leads me
here today. I am struggling to write a particular type of view and hope
I can find some guidance here...

To summarize here is what I am trying to achieve: 
my database is filled with requests containing (among other things)
datetime and client_id. The view I'm trying to write should display the
number of occurrences for a date range grouped by client_id.
Unfortunately I don't manage to create a view that would contain the
expected result with the right format. The closest I could do was
producing a result as follow:
[2009, 11, 19, 61] => 14 
[2009, 11, 20, 61] => 30
[2009, 11, 20, 64] => 30
This represents 14 occurences for the client 61 on the 2009-11-19, 30 on
the 2009-11-20 and so on. What I would like to retrieve is a resulted
grouped on client id to avoid having multiple rows for the same client
The view is called with

This is important for me because not being able to group mean I am
getting a "row" per day per client what leads to a response to big a
makes the latency to big on front.


View raw message