How does couchbase distribute the index files?


I want to know more about the distribution architecture of couchbase’s views. Are all key/value stored in the same node as their documents? Or, are all key/value pairs shared with the same key stored in a same node (or vBucket)?



A document’s key and value are both stored in the same vBucket. If you think about it, storing them in different vBuckets wouldn’t be very helpful as you’d have to potentially go to two different vBuckets to read a whole document.

If you’re interested, more details are available in the Architecture whitepaper:

Thanks, Dave. So for views with reduce functions, the server needs to re-reduce across nodes for every query, right?

It will need to re-reduce across all nodes, yes when the view is updated. The result is cached however so subsequent accesses of the view (before the next view update) can be quickly returned.