Hi all,
I would like to run delete query but it is working very slow. I am using 6.0.0 community edition. I have tried this.
DELETE FROM appconnect WHERE _class = “engage.data.couchbase.entity.AudienceMemberEntity”
AND appId = “APCMQH” AND audienceId = “0f2de811-c482-11e9-a180-45ac70e4a33”
and my index is
CREATE INDEX audience_members_idx
ON appconnect
(_class
,appId
,audienceId
) WHERE (_class
= “engage.data.couchbase.entity.AudienceMemberEntity”)
If I use select query and limit by 2500 it works very fast, but my document count is around 300.000 ~. How can I fasten this query because I am facing with query timeout and it exceeds 75 second. My explain query:
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "IndexScan3",
"index": "audience_members_idx",
"index_id": "d1bd089c690c2ca8",
"index_projection": {
"primary_key": true
},
"keyspace": "appconnect",
"namespace": "default",
"spans": [
{
"range": [
{
"high": "\"engage.data.couchbase.entity.AudienceMemberEntity\"",
"inclusion": 3,
"low": "\"engage.data.couchbase.entity.AudienceMemberEntity\""
},
{
"inclusion": 0,
"low": "null"
},
{
"inclusion": 0,
"low": "null"
}
]
}
],
"using": "gsi"
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Fetch",
"keyspace": "appconnect",
"namespace": "default"
},
{
"#operator": "Filter",
"condition": "((((`appconnect`.`appId`) = (`appconnect`.`whitelabel`)) and ((`appconnect`.`audienceId`) = (`appconnect`.`1b7192e6-c44b-11e9-8cff-11eb4ce107c`))) and ((`appconnect`.`_class`) = \"engage.data.couchbase.entity.AudienceMemberEntity\"))"
},
{
"#operator": "SendDelete",
"alias": "appconnect",
"keyspace": "appconnect",
"namespace": "default"
},
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "`appconnect`",
"star": true
},
{
"as": "_ID",
"expr": "(meta(`appconnect`).`id`)"
},
{
"as": "_CAS",
"expr": "(meta(`appconnect`).`cas`)"
}
]
},
{
"#operator": "FinalProject"
}
]
}
}
]
},
"text": "DELETE FROM `appconnect` \nWHERE (`appId` = `whitelabel` AND `audienceId` = `1b7192e6-c44b-11e9-8cff-11eb4ce107`) \nAND `_class` = \"engage.data.couchbase.entity.AudienceMemberEntity\" \nRETURNING `appconnect`.*, META(`appconnect`).id AS _ID, META(`appconnect`).cas AS _CAS"
} ```