Queries take minutes with N1QL

n1ql

#1

I am using Couchbase Server 4.5.1-2844 Community Edition.
I am doing queries (using indexes ) with count and they take over 3 minutes. How is it possible?
For example this query gives result after 4 minutes.

SELECT COUNT(Consist), Consist FROM test-couchbase-ale GROUP BY Consist;


#2

It depends on the index. Try with following index.
CREATE INDEX ix1 ON test-couchbase-ale(Consist);

GROUP BY operation takes time. Please follow technique described here https://dzone.com/articles/count-amp-group-faster-using-n1ql


#3

I had already created that index and also added IS NOT MISSING condition. Can I make it even faster?
I am working with 1,2 million of docs.


#4

For GROUP BY query you can follow option suggested in above link. You can also increase max_parallelism


#5

@devbase,

out of the 1.2 million docs how many docs is the indexing reducing it by. Sounds like the query service is fetching a lot of docs to satisfy your query.