Search code examples
design-patternsmemcacheddistributed-cachingcouchbase

Couchbase: is it better to retrieve a list object or each object individually?


I'm currently using couchbase for quick and distributed access of data. I have Community objects being stored by the keys "comm-{index}" where {index} is the key index for a given community object (i.e. comm-1 stores object 1, comm-2 stores object 2 a so on).

I need to retrieve a list containing all of the Community objects, and I wonder: would it be better (faster) to do a GET of every object one by one and add it to a list, or otherwise, storing a List object identified by a key, and retrieve the whole list object in one GET?

I'm unsure if because of couchbase's distributed nature and limited size for objects, it would be faster or just equally fast to retrieve every object individually (such as many couchbase examples do).


Solution

  • Couchbase 2.0 will support Map/Reduce powered views, which allows you to write map function which will filter out all the keys you need and then build incremental index