Description
Unnest using covered index we may have to remove DistinctScan (due to distinct on meta().id).
CREATE INDEX by_replies ON default (ALL ARRAY r.`user` FOR r IN replies END, title);
explain SELECT t.title, r.`user` FROM default t UNNEST t.replies AS r WHERE r.`user` = "bcf160-000000000538”;
explain SELECT t.title, r.`user` FROM default t UNNEST t.replies AS r WHERE r.`user` IN [ "bcf160-000000000538", "ccf160-000000000538" ];
{
"requestID": "c18df553-57f3-4aa7-901c-dcd9139df051",
"signature": "json",
"results": [
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "DistinctScan",
"scan": {
"#operator": "IndexScan",
"covers": [
"cover ((`r`.`user`))",
"cover ((`t`.`title`))",
"cover ((meta(`t`).`id`))"
],
"index": "by_replies",
"index_id": "aa6e10c282d257b6",
"keyspace": "default",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"\"bcf160-000000000538\""
],
"Inclusion": 3,
"Low": [
"\"bcf160-000000000538\""
]
}
},
{
"Range": {
"High": [
"\"ccf160-000000000538\""
],
"Inclusion": 3,
"Low": [
"\"ccf160-000000000538\""
]
}
}
],
"using": "gsi"
}
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Filter",
"condition": "(cover ((`r`.`user`)) in [\"bcf160-000000000538\", \"ccf160-000000000538\"])"
},
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "cover ((`t`.`title`))"
},
{
"expr": "cover ((`r`.`user`))"
}
]
},
{
"#operator": "FinalProject"
}
]
}
}
]
},
"text": "SELECT t.title, r.`user` FROM default t UNNEST t.replies AS r WHERE r.`user` IN [ \"bcf160-000000000538\", \"ccf160-000000000538\" ];"
}
],
"status": "success",
"metrics": {
"elapsedTime": "5.339364ms",
"executionTime": "5.319885ms",
"resultCount": 1,
"resultSize": 3360
}
}
Attachments
Issue Links
- blocks
-
MB-22188 4.6.2 Minor Release
-
- Closed
-