I’m evaluating Couchbase CE 5.0.1 (build 5003), I have a 4 nodes cluster on AWS (r4.2xlarge) each with 1TB volume and 61GB RAM.
I have a bucket with ~3M documents and all relevant fields are indexed using GSI.
Any COUNT query or any query with criteria or order clause takes a long time (e.g. Select Count(*) query takes over 18 seconds).
Looking at the query plan shows that the query is based on index scan only. I think all the index is in the RAM, there is no swap and yet, this is extremely poor performance (MySQL and PostgreSQL outperform Couchbase in these types of queries).
How can one optimize the query engine? is this the top performance of Couchbase?
Here is the explain plan results:
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "IndexCountScan2",
"covers": [
"cover ((`innovi-events`.`_type`))",
"cover ((meta(`innovi-events`).`id`))"
],
"index": "idx_type",
"index_id": "fb34f583f631a2b9",
"keyspace": "innovi-events",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"event\"",
"inclusion": 3,
"low": "\"event\""
}
]
}
],
"using": "gsi"
},
{
"#operator": "IndexCountProject",
"result_terms": [
{
"as": "cnt",
"expr": "count(*)"
}
]
}
]
},
"text": "SELECT count(*) cnt FROM `innovi-events` WHERE (_type = 'event')"
}