Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for 
change notification.

The following page has been changed by BrianCandler:
http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views

------------------------------------------------------------------------------
  
  See HttpViewApi to learn how to work with views. ["View_Snippets"] contain a 
few examples.
  
- == Restrictions on map and reduce functions ===
+ == Restrictions on map and reduce functions ==
  
  The restriction on map functions is that they must be referentially 
transparent. That is, given the same input document, they will always emit the 
same key/value pairs. This allows CouchDB views to be updated incrementally, 
only reindexing the documents that have changed since the last index update.
  
  To make incremental Map/Reduce possible, the Reduce function has the 
requirement that not only must it be referentially transparent, but it must 
also be commutative and associative for the array value input, to be able 
reduce on its own output and get the same answer, like this:
  
+ {{{
  f(Key, Values) == f(Key, [ f(Key, Values) ] )
+ }}}
  
  This requirement of reduce functions allows CouchDB to store off 
intermediated reductions directly into inner nodes of btree indexes, and the 
view index updates and retrievals will have logarithmic cost. It also allows 
the indexes to be spread across machines and reduced at query time with 
logarithmic cost.
  

Reply via email to