Group By Type slow

I have a bucket with 1.7 documents and trying to use Analytics get to the document count by type. But it’s taking over 16 seconds. Our mapreduce view (which we are replacing) that does the samething return under a 1 second.

I have tried a index
SELECT s.type as t, count(*) as total FROM bucket s Group by s.type

and a view but both seem slow,

And pointers?

Hello @dipen_patel ,
could you please add more details so the issue is clearer:

  • You mentioned 1.7 documents, that seems to be a typo, can you mention the correct number of documents?
  • What version of Couchbase Server are you running?
  • What is your Analytics setup? What’s the number of nodes and number of partitions on each node for the Analytics cluster?
  • Can you share the DDL you used to create the index?
  • Can you share the query plan of your query?

Thanks.

If SQL++ for query (EE)

CREATE INDEX ix1 ON bucket(type) PARTITION BY HASH(type);
SELECT type as t, count(1) as total 
FROM bucket s 
WHERE type IS NOT NULL
GROUP BY type

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.