incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: Slow Map Reduce
Date Sat, 24 Oct 2009 00:37:20 GMT
On Fri, Oct 23, 2009 at 5:00 PM, Seggy Umboh <seggy.umboh@gmail.com> wrote:
> One thing I have found useful is to fire up js on the command line and just
> assign a sample document to the variable doc, then run the map function on
> that.

Sounds cool, if you put together a blog post on the technique I bet
people (including me) would read it.

>
> On Fri, Oct 23, 2009 at 4:18 AM, Rajkumar S <rajkumars@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks, I had caught this bug and fixed it in the map, but did not
>> update the mail. I just wanted the sum. but right now I am not using a
>> reduce function just a map. Even for that I am not getting a result.
>>
>> Any way I am just learning the ropes so might take some  time before I
>> figure out the stuff :)
>>
>> raj
>>
>> On Fri, Oct 23, 2009 at 6:40 AM, Seggy Umboh <seggy.umboh@gmail.com>
>> wrote:
>> > It looks like you just want to find out how many rows were emitted? That
>> > would just be the typical sum right?
>> > return sum(values);
>> >
>> >
>> >
>> > js> var v = 6
>> > js> 0 + v.length
>> > NaN
>> >
>> >
>> >
>> > On Wed, Oct 21, 2009 at 11:45 PM, Rajkumar S <rajkumars@gmail.com>
>> wrote:
>> >
>> >> On Wed, Oct 21, 2009 at 9:48 PM, Paul Joseph Davis
>> >> <paul.joseph.davis@gmail.com> wrote:
>> >> > I suspect "return values;" is the culprit here. That's pretty much
>> >> guranteed
>> >> > to cause you problems as the data grows recursing up the tree. 0.10.0
>> >> even
>> >> > detects this and throws an error to avoid precisely this issue.
>> >> >
>> >> > It's been discussed a couple times on the list but my stomach is
>> >> rumbling.
>> >>
>> >> That reduce function used in that log was the following.
>> >>
>> >> function(keys, values, rereduce)
>> >> {
>> >>    length = 0;
>> >>    if (rereduce){
>> >>        for(var v = 0; v < values.length; v++){
>> >>            length = length + v.length;
>> >>        }
>> >>    } else {
>> >>        length = values.length;
>> >>    }
>> >>    return length;
>> >> }
>> >>
>> >> The reduce function should returns a single integer and not cause data
>> >> to grow. Let me try with simpler map with no reduce and will report
>> >> the results.
>> >>
>> >> with regards,
>> >> raj
>> >>
>> >
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message