-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Querying
-
Query Optimization
-
Fully Compatible
-
v7.0, v6.3, v6.0, v5.0, v4.4
-
QO 2023-03-06, QO 2023-03-20, QO 2023-04-03, QO 2023-04-17, QO 2023-05-01
-
(copied to CRM)
-
None
-
None
-
None
-
None
-
None
-
None
-
None
db.xxx.ensureIndex({x:1},{partialFilterExpression:{bin:true}})
> db.xxx.find({bin:true,x:1}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "test.xxx",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{"bin" : {"$eq" : true}},
{"x" : {"$eq" : 1}}
]
},
"winningPlan" : {
"stage" : "FETCH",
"filter" : {"bin" : {"$eq" : true}},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {"x" : 1},
"indexName" : "x_1",
"isMultiKey" : false,
"multiKeyPaths" : { "x" : [ ] },
"isUnique" : false,
"isSparse" : false,
"isPartial" : true,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : { "x" : [ "[1.0, 1.0]" ] }
}
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "AD-MAC10G.local",
"port" : 27017,
"version" : "3.4.2",
"gitVersion" : "3f76e40c105fc223b3e5aac3e20dcd026b83b38b"
},
"ok" : 1
}
There's no need to do the FETCH with a check on bin:true since that condition is already satisfied by the index partial filterexpression
- is duplicated by
-
SERVER-29247 COUNT_SCAN not used for partial indexes
-
- Closed
-
-
SERVER-42647 Compound partialFilterExpression not being used - despite correct index chosen
-
- Closed
-
-
SERVER-44836 count_documents with filter does not use the partialFilterExpression index right when the keys in the filter are indexed
-
- Closed
-
-
SERVER-48777 Covered Queries do not work with partial indices
-
- Closed
-
-
SERVER-32035 Index doesn't cover a query for a partial filter expression index under certain circumstances
-
- Closed
-
- is related to
-
SERVER-26896 Use knowledge about partial index filter expression to determine whether $exists predicate can be covered
-
- Backlog
-
-
SERVER-75025 [CQF] Add test for optimizer-specific fix for SERVER-28889
-
- Closed
-
- related to
-
SERVER-29247 COUNT_SCAN not used for partial indexes
-
- Closed
-
-
SERVER-55065 Null queries should be covered by index where possible with current index format
-
- Closed
-
-
SERVER-56020 Unnecessary FETCH stage
-
- Closed
-
-
SERVER-26580 allow using partial index on query where predicate matches only partial filter expression
-
- Backlog
-