Index
CREATE INDEX
test_idx
ONdefault
(login
) WHERE ((((classType
= “Order”) and (0 <close_time
)) and ((cmd
= 0) or (cmd
= 1))) and (server
= “3”))
Query takes 15s, indexed items 841K, this query result is 81247.
Any possibility to shorten the time under 100ms like views?
select COUNT(meta().id) from default use index(test_idx)
where classType = “Order”
and close_time > 0
and server = “3”
and login between 70000000 and 79999999
and (cmd = 0 or cmd = 1)
explain
[
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "IndexScan",
"index": "test_idx",
"index_id": "32550db8ae45bc76",
"keyspace": "default",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"79999999"
],
"Inclusion": 3,
"Low": [
"70000000"
]
}
}
],
"using": "gsi"
},
{
"#operator": "Fetch",
"keyspace": "default",
"namespace": "default"
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Filter",
"condition": "((((((`default`.`classType`) = \"Order\") and (0 < (`default`.`close_time`))) and ((`default`.`server`) = \"3\")) and ((`default`.`login`) between 70000000 and 79999999)) and (((`default`.`cmd`) = 0) or ((`default`.`cmd`) = 1)))"
},
{
"#operator": "InitialGroup",
"aggregates": [
"count((meta(`default`).`id`))"
],
"group_keys": []
}
]
}
},
{
"#operator": "IntermediateGroup",
"aggregates": [
"count((meta(`default`).`id`))"
],
"group_keys": []
},
{
"#operator": "FinalGroup",
"aggregates": [
"count((meta(`default`).`id`))"
],
"group_keys": []
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "count((meta(`default`).`id`))"
}
]
},
{
"#operator": "FinalProject"
}
]
}
}
]
},
"text": "select COUNT(meta().id) from default use index(test_idx)\nwhere classType = \"Order\"\nand close_time > 0\nand server = \"3\"\nand login between 70000000 and 79999999\nand (cmd = 0 or cmd = 1)"
}
]