Thanks for your help.
Actually, looks like some of these settings are set directly on the query object (undocumented?) such as:
$query->max_parallelism = 2;
But even with these changes, timeouts still happen (now the message is different, it now complains about an “Index Scan Timeout”).
I.e. this is the query that timeouts:
EXPLAIN DELETE FROM couch WHERE META(couch).id LIKE “www.aaa.com|cache_menu|admin_menu:%”;
{
"requestID": "42bfae67-6d69-41e0-bfd4-1564deffa0fd",
"signature": "json",
"results": [
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "IndexScan",
"covers": [
"cover ((meta(`couch`).`id`))",
"cover ((meta(`couch`).`id`))"
],
"index": "id_ix",
"index_id": "dca2f008bdb837aa",
"keyspace": "couch",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"\"www.aaa.com|cachf\""
],
"Inclusion": 1,
"Low": [
"\"www.aaa.com|cache\""
]
}
}
],
"using": "gsi"
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Filter",
"condition": "(cover ((meta(`couch`).`id`)) like \"www.aaa.com|cache_menu|a
dmin_menu:%\")"
},
{
"#operator": "SendDelete",
"alias": "couch",
"keyspace": "couch",
"namespace": "default"
}
]
}
},
{
"#operator": "Discard"
}
]
},
"text": "DELETE FROM couch WHERE META(couch).id LIKE \"www.aaa.com|cache_menu|admin_menu:%\""
}
],
"status": "success",
"metrics": {
"elapsedTime": "20.0014ms",
"executionTime": "20.0014ms",
"resultCount": 1,
"resultSize": 2263
}
}
The involved index is this one:
CREATE INDEX
id_ixON
couch((meta().
id))
The couchbase server has a dedicated 4CPU 8Gb RAM machine that is sitting idle all the time, with just a single multi-tenant bucket:
These timeouts just seem to make no sense to me, specially the Index Scan timeout. How can it timeout scanning 260,000 documents?
Looking at the Explain results, seems like first index scan is not filtering the complete prefix, but only part of it.