couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Marca <jma...@translab.its.uci.edu>
Subject how do I do different reduce operations on the same map
Date Tue, 10 Feb 2009 22:31:58 GMT
I have a situation where I want to run two different reduce functions
on the output of a single map function.  Like suppose I want one
reduce function to get the count of all objects in each group (for
example, documents with or without attachments), and another reduce to
compute some other aggregate, like the average and standard deviation
of a value, (like the average size of attached documents).  (Yes, I
know this is a stupid example, as the averaging reduce function will
also have the count, but my real case is too complicated to write
easily).

Should one strive for a minimal set of reduce functions per map (one
reduce for all three count, average, std deviation), or does it make
sense to identically copy the maps and make multiple reduce functions
(one reduce _each_ for count, mean, std dev)?  (again, ignore the fact
that you compute  count and mean when computing std dev, etc)

I have a feeling from reading the various docs that identical map
functions are only executed once in CouchDB.  If that is true, then is
it _also_ true that having lots of reduce functions for one map is not
any more expensive (in terms of space and computational speed) than
trying for a minimal set of map-reduce pairs.  Any advice on this?

Thanks in advance, 
James






-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Mime
View raw message