What kind of indexes to use

n1ql

#1

Hi team ,

We have an application that loads a couchbase database continuously using data stream .
We will have api’s on top of couchbase to expose the data that gets loaded and they need to be indexed continuesly . we have a 60 ms sla for all the api calls that pulls data from couchbase .

What will be best to use
Memory optimized indexes
Global secondary indexes

What should we do to make sure that data that data is indexed most efficiently and there is no data latency due to index rebuilds


#2

“Memory optimized indexes” are more efficient that “Global Secondary Indexes” but the cost is higher as all the indexed data needs to be in memory.

The actual latencies would depend on a lot of factors such as mutation rate in the cluster, CPUs on the box, total number of indexes, scan throughput, range of data selected by each scan etc. It would be good to do a POC and see what latencies you see and tune/decide accordingly.