On 10 November 2013 23:14, Mark Deibert <[email protected]> wrote: > I read an article somewhere that using include_docs is "hard" on memory or > disk or in some way taxes Couch and therefore you should just emit the doc. > Is this true?
Like most general statements it has some truth and some lies in it :-) views and docs are stored in separate .couch btree files on disk. emit(key, doc) puts a full copy of the doc (that's already in the doc .couch b~tree) into the view b~tree. advantage - no need to hop over to the doc .couch file to retrieve the document. disadvantage - you now have 2 copies of the doc in separate files, wasted space. If you do things right, and your app fits this model, the generated etags from views and docs can be cached in nginx or similar, and repeated queries don't need to hit your couch. So yes, include_docs means extra reads, but like most of these things you should benchmark your situation, under a realistic load, not just pumping 1000 single-doc reads at it. A+ Dave
