-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
Fully Compatible
-
ALL
-
v6.3, v6.0
-
QE 2023-02-20
When we have a query on a clustered collection that both filters and sorts on the clustered index key, we generate two of the same plan.
First time:
Then again here:
This doesn’t cause incorrect results because both plans are correct, but it will make us cache plans and do multi planning in situations where we otherwise wouldn’t have to.
MongoDB Enterprise > db.createCollection("clustered_collection", {clusteredIndex: {key: {_id: 1}, unique: true}}) { "ok" : 1 } MongoDB Enterprise > db.clustered_collection.find({_id: 5}).sort({_id: 1}).explain().queryPlanner { "namespace" : "test2.clustered_collection", "indexFilterSet" : false, "parsedQuery" : { "_id" : { "$eq" : 5 } }, "queryHash" : "5B20DB79", "planCacheKey" : "5B20DB79", "maxIndexedOrSolutionsReached" : false, "maxIndexedAndSolutionsReached" : false, "maxScansToExplodeReached" : false, "winningPlan" : { "stage" : "CLUSTERED_IXSCAN", "filter" : { "_id" : { "$eq" : 5 } }, "direction" : "forward", "minRecord" : 5, "maxRecord" : 5 }, "rejectedPlans" : [ { "stage" : "CLUSTERED_IXSCAN", "filter" : { "_id" : { "$eq" : 5 } }, "direction" : "forward", "minRecord" : 5, "maxRecord" : 5 } ] }
- depends on
-
SERVER-73009 Decreasing order sort on clustered collections on replica sets returns increasing order
- Closed
- is caused by
-
SERVER-60824 Support non-blocking sort() on cluster key
- Closed
-
SERVER-58276 Add time-series bounded collection scan plans to query multi-planner
- Closed