This is 5.0.1 Community edition.
Plan for Query 2
{
“plan”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “IndexScan2”,
“index”: “idx_01”,
“index_id”: “2cb329ed9071ba64”,
“index_projection”: {
“primary_key”: true
},
“keyspace”: “bucket”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: “"ORDER"”,
“inclusion”: 3,
“low”: “"ORDER"”
},
{
“high”: “"X"”,
“inclusion”: 3,
“low”: “"X"”
},
{
“high”: “"100"”,
“inclusion”: 3,
“low”: “"100"”
}
]
},
{
“exact”: true,
“range”: [
{
“high”: “"ORDER"”,
“inclusion”: 3,
“low”: “"ORDER"”
},
{
“high”: “"X"”,
“inclusion”: 3,
“low”: “"X"”
},
{
“high”: “"101"”,
“inclusion”: 3,
“low”: “"101"”
}
]
}
],
“using”: “gsi”
},
{
“#operator”: “Fetch”,
“keyspace”: “bucket”,
“namespace”: “default”
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Filter”,
“condition”: “(((true and ((bucket
.type
) = "ORDER")) and ((bucket
.orderType
) in ["X"])) and (((bucket
.orderDetails
).code
) in ["100", "101"]))”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“as”: “_ID”,
“expr”: “(meta(bucket
).id
)”
},
{
“as”: “_CAS”,
“expr”: “(meta((bucket
.bucket\r\n
)).cas
)”
},
{
“expr”: “bucket
”,
“star”: true
}
]
}
]
}
}
]
},
{
“#operator”: “Order”,
“limit”: “200”,
“sort_terms”: [
{
“expr”: “(bucket
.type
)”
},
{
“expr”: “(bucket
.orderType
)”
},
{
“expr”: “((bucket
.orderDetails
).code
)”
}
]
},
{
“#operator”: “Limit”,
“expr”: “200”
},
{
“#operator”: “FinalProject”
}
]
},
“text”: “SELECT META(bucket
).id as _ID, META(bucket\r\n
).cas as _CAS, bucket
.* FROM bucket
WHERE TRUE AND type = ‘ORDER’ AND orderType IN ["X"] AND\r\norderDetails.code IN ["100","101"]\r\nORDER BY type ASC, orderType ASC, orderDetails.code ASC LIMIT 200 OFFSET 0”
}
Plan for Query 1:
{
“plan”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “IndexScan2”,
“index”: “idx_01”,
“index_id”: “2cb329ed9071ba64”,
“index_projection”: {
“primary_key”: true
},
“keyspace”: “bucket”,
“limit”: “200”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: “"ORDER"”,
“inclusion”: 3,
“low”: “"ORDER"”
},
{
“high”: “"X"”,
“inclusion”: 3,
“low”: “"X"”
},
{
“high”: “"100"”,
“inclusion”: 3,
“low”: “"100"”
}
]
}
],
“using”: “gsi”
},
{
“#operator”: “Fetch”,
“keyspace”: “bucket”,
“namespace”: “default”
},
{
“#operator”: “Parallel”,
“maxParallelism”: 1,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Filter”,
“condition”: “(((true and ((bucket
.type
) = "ORDER")) and ((bucket
.orderType
) in ["X"])) and (((bucket
.orderDetails
).code
) in ["100"]))”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“as”: “_ID”,
“expr”: “(meta(bucket
).id
)”
},
{
“as”: “_CAS”,
“expr”: “(meta((bucket
.bucket\r\n
)).cas
)”
},
{
“expr”: “bucket
”,
“star”: true
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
},
{
“#operator”: “Limit”,
“expr”: “200”
}
]
},
“text”: “SELECT META(bucket
).id as _ID, META(bucket\r\n
).cas as _CAS, bucket
.* FROM bucket
WHERE TRUE AND type = ‘ORDER’ AND orderType IN ["X"] AND\r\norderDetails.code IN ["100"]\r\nORDER BY type ASC, orderType ASC, orderDetails.code ASC LIMIT 200 OFFSET 0”
}