Map reduce cached data

I know that map reduce data incrementally updated and cached
But how it is possible for filtering and grouping result? it is unlimited filtering cases

How views works exactly? assume we emit([doc.location,],doc.sallary) and use _sum as reducer

Okay, we have a cached sum for whole data in view
But I choose group level 2 , is there cache for it?
What about key range filter?

Please reply …

@matthew.groves @siri can you help me?

Up again …

@socketman2016, We have started looking into it. Shall respond asap. Thank you for your patience.

Hi @socketman2016,

View-engine uses btree to store indexes. It will run map function on each document and emitted value will be the leaf node of the btree along with the values. Leaf nodes will be in a sorted fashion.
The reduce function is applied at the time of btree writes into the file. View-engine consists of reduce and rereduce javascript functions. The reduce function is used to obtain a reduce value from key value pairs obtained by applying map function. The rereduce function is used to combine existing reduce values to obtain combined reduce value.
In case of a mutation, it will update only the subtree of its range and not the entire tree.

In case of group_level queries, whenever there is a group formed(group_level=2) within an internal node it will return those results from that internal node instead of traversing the subtree.
For example:In case of group_level=2, view-engine will check the first 2 values of the compound keys. If an internal node forms a group(first 2 values same), then view-engine will return the result. Otherwise it will traverse the subtree.

1 Like