couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Date Fri, 30 Jan 2009 14:00:09 GMT
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 ===
+ 
+ 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.
+ 
+ For more details see [http://damienkatz.net/2008/02/incremental_map.html this blog post]
+ 

Mime
View raw message