Dear wiki user, You have subscribed to a wiki page "Couchdb Wiki" for change notification.
The page "Why are all Views in a single Index" has been deleted by JoanTouzet: https://wiki.apache.org/couchdb/Why%20are%20all%20Views%20in%20a%20single%20Index?action=diff&rev1=3&rev2=4 Comment: Migrated to the official CouchDB docs as of 2.2 - = Why are all Views in a single Index = - by [[http://fdmanana.wordpress.com/|Filipe Manana]] - Each view basically corresponds to one btree. All views live in the same index file. Other than saving the number of file descriptors and possibly, some OS page caching benefits, and simpler code, I don't think there's more benefits. - - However, the most significant benefit comes when you have two (or more) views with the same map function in a single design document. - - For example: - - {{{ - view1: { - "map": - "function(doc) { - if (doc.type === 'foo') { - emit(key, value); - } - }", - "reduce": "_count" - } - }}} - {{{ - view2: { - "map": - "function(doc) { - if (doc.type === 'foo') { - emit(key, value); - } - }", - "reduce": "_sum" - } - }}} - Here view1 and view2 have exactly the same map function. If they were in different design documents, there would be two b-trees (in two different index files) for exactly the same data. Now, if they are in a single design document, we use one b-tree only, but we save disk space and update time by only updating one btree instead of two. Of course, this is easy only because we use one single index file for a design document with multiple views. - - == Other Reasons: == - ||<tablewidth="100%"> {{https://si0.twimg.com/profile_images/1611440478/IMG_0049_normal.jpg|jchris}} ||'''jchris'''<<BR>>@bigbluehat @fdmanana also a combined index file can keep a single index of back refs from docids to rows, for invalidating old rows<<BR>> [[https://twitter.com/jchris/status/169514764693803010|2/14/12 3:14 PM]] || -