I try to update many documents (~4638) in query from 46000 docs. Execution time is 12 s !!! Very slow? How can I optimize query ?
UPDATE `cms-deploy` SET status = 'progress'
WHERE _scope='rolling' AND status = 'active'
I use index
CREATE INDEX `Index_status` ON `cms-deploy`(`status`) PARTITION BY hash(`_scope`)
Explain plan is:
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “IntersectScan”,
“scans”: [
{
“#operator”: “IndexScan3”,
“index”: “Index_status”,
“index_id”: “12b8306ddcf40233”,
“index_projection”: {
“primary_key”: true
},
“keyspace”: “cms-deploy”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: ““active””,
“inclusion”: 3,
“low”: ““active””
}
]
}
],
“using”: “gsi”
},
{
“#operator”: “IndexScan3”,
“index”: “adv_scope_type”,
“index_id”: “929c00ebc66d7d72”,
“index_projection”: {
“primary_key”: true
},
“keyspace”: “cms-deploy”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: ““rolling””,
“inclusion”: 3,
“low”: ““rolling””
}
]
}
],
“using”: “gsi”
}
]
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Fetch”,
“keyspace”: “cms-deploy”,
“namespace”: “default”
},
{
“#operator”: “Filter”,
“condition”: “(((cms-deploy
._scope
) = “rolling”) and ((cms-deploy
.status
) = “active”))”
},
{
“#operator”: “Clone”
},
{
“#operator”: “Set”,
“set_terms”: [
{
“path”: “(cms-deploy
.status
)”,
“value”: ““progress””
}
]
},
{
“#operator”: “SendUpdate”,
“alias”: “cms-deploy”,
“keyspace”: “cms-deploy”,
“namespace”: “default”
}
]
}
},
{
“#operator”: “Discard”
}
]
}