Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
Query Optimization
-
Quint 9 09/18/15
-
(copied to CRM)
Description
Currently, indexed .remove() plans will always fetch the documents associated with the index keys before performing the remove:
> t.drop()
|
true
|
> t.ensureIndex({x: 1})
|
{
|
"createdCollectionAutomatically" : true,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
> t.explain().remove({x: {$gte: 5, $lte: 10}})
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.t",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"$and" : [
|
{
|
"x" : {
|
"$lte" : 10
|
}
|
},
|
{
|
"x" : {
|
"$gte" : 5
|
}
|
}
|
]
|
},
|
"winningPlan" : {
|
"stage" : "DELETE",
|
"inputStage" : {
|
"stage" : "FETCH", // This stage is not needed!
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"x" : 1
|
},
|
"indexName" : "x_1",
|
"isMultiKey" : false,
|
"direction" : "forward",
|
"indexBounds" : {
|
"x" : [
|
"[5.0, 10.0]"
|
]
|
}
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"serverInfo" : {
|
"host" : "dstorch-desktop",
|
"port" : 27017,
|
"version" : "3.1.0-pre-",
|
"gitVersion" : "ee4db2a36eb894e2694fea781ab70f0cca33d0b8"
|
},
|
"ok" : 1
|
}
|
As an optimization, we could change the query planner to generate indexed .remove() plans without the FETCH stage.
Attachments
Issue Links
- is duplicated by
-
SERVER-27622 Skip document read from disk when delete with IdHack plan
-
- Closed
-
- related to
-
SERVER-27822 Count plans sometimes don't need a FETCH
-
- Closed
-
-
SERVER-17266 count command performance optimization should support more complex queries
-
- Backlog
-
-
SERVER-80423 Make the preImage document always available to OplogDeleteEntryArgs
-
- Closed
-