couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hhsuper <hhsu...@gmail.com>
Subject Re: when we should implement the rereduce in reduce function
Date Mon, 22 Jun 2009 01:18:06 GMT
Thanks guys, I got more info from wiki these two days, like you say that
rereduce is for internal caculating, we always impl it although we may not
be explicitly handle rereduce==true sometimes

On Mon, Jun 22, 2009 at 6:13 AM, Zachary Zolton <zachary.zolton@gmail.com>wrote:

> One thing that might not be clear, from some of the examples, is that
> you don't have to explicitly handle the rereduce == true case when the
> shape of the data emitted from the map is the same as that returned by
> the reduce. This is the case when using reduce to return the sum of an
> array of numeric values, for instance.
> —Zach
>
> On Sun, Jun 21, 2009 at 3:21 PM, Brian Candler<B.Candler@pobox.com> wrote:
> > On Mon, Jun 15, 2009 at 02:28:17PM +0800, hhsuper wrote:
> >> Hi, guys, I need some help, i want to know when we should implement the
> >> rereduce in reduce function?
> >
> > Answer: always.
> >
> > Once you get above a handful of documents you will see re-reduces taking
> > place. This is because reduce is done in multiple steps:
> >
> >    doc \
> >    doc -> reduce -
> >    doc /          \
> >    doc \           \
> >    doc -> reduce ---rereduce --> answer
> >    doc /           /
> >    doc \          /
> >    doc -> reduce -
> >    doc /
> >
> > Also: each btree node contains a bunch of documents, and the btree node
> also
> > contains a cached reduce value for that set of docs. This makes it much
> > cheaper for couchdb to calculate the reduce value across a range of keys;
> it
> > can use already-reduced values where available, and combine them using
> > rereduce.
> >
> > There's more info linked from the Wiki.
> >
> > Regards,
> >
> > Brian.
> >
>



-- 
Yours sincerely

Jack Su

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message