|
Similar explain with 3.5.13:
db.c.explain("executionStats").find({x:/j/})
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "db1.c",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"x" : {
|
"$regex" : "j"
|
}
|
},
|
"winningPlan" : {
|
"stage" : "FETCH",
|
"filter" : {
|
"x" : {
|
"$regex" : "j"
|
}
|
},
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"x" : 1
|
},
|
"indexName" : "x_1",
|
"isMultiKey" : true,
|
"multiKeyPaths" : {
|
"x" : [
|
"x"
|
]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"x" : [
|
"[\"\", {})",
|
"[/j/, /j/]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 0,
|
"executionTimeMillis" : 0,
|
"totalKeysExamined" : 10,
|
"totalDocsExamined" : 4,
|
"executionStages" : {
|
"stage" : "FETCH",
|
"filter" : {
|
"x" : {
|
"$regex" : "j"
|
}
|
},
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 11,
|
"advanced" : 0,
|
"needTime" : 10,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"docsExamined" : 4,
|
"alreadyHasObj" : 0,
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"nReturned" : 4,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 11,
|
"advanced" : 4,
|
"needTime" : 6,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"x" : 1
|
},
|
"indexName" : "x_1",
|
"isMultiKey" : true,
|
"multiKeyPaths" : {
|
"x" : [
|
"x"
|
]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"x" : [
|
"[\"\", {})",
|
"[/j/, /j/]"
|
]
|
},
|
"keysExamined" : 10,
|
"seeks" : 1,
|
"dupsTested" : 10,
|
"dupsDropped" : 6,
|
"seenInvalidated" : 0
|
}
|
}
|
},
|
"serverInfo" : {
|
"host" : "Asyas-MacBook-Pro.local",
|
"port" : 27017,
|
"version" : "3.5.13",
|
"gitVersion" : "52bbaa007cd84631d6da811d9a05b59f2dfad4f3"
|
},
|
"ok" : 1
|
}
|
Note (at least in current version) that left anchored regex that's case sensitive seems to correctly handle the query and only FETCH the documents that are candidates (so when there's 0 returned, it doesn't FETCH any documents).
127.0.0.1:27017(3.5.13) > db.c.explain("executionStats").find({x:/^j/})
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "db1.c",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"x" : {
|
"$regex" : "^j"
|
}
|
},
|
"winningPlan" : {
|
"stage" : "FETCH",
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"x" : 1
|
},
|
"indexName" : "x_1",
|
"isMultiKey" : true,
|
"multiKeyPaths" : {
|
"x" : [
|
"x"
|
]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"x" : [
|
"[\"j\", \"k\")",
|
"[/^j/, /^j/]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 0,
|
"executionTimeMillis" : 0,
|
"totalKeysExamined" : 1,
|
"totalDocsExamined" : 0,
|
"executionStages" : {
|
"stage" : "FETCH",
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 2,
|
"advanced" : 0,
|
"needTime" : 1,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"docsExamined" : 0,
|
"alreadyHasObj" : 0,
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 2,
|
"advanced" : 0,
|
"needTime" : 1,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"x" : 1
|
},
|
"indexName" : "x_1",
|
"isMultiKey" : true,
|
"multiKeyPaths" : {
|
"x" : [
|
"x"
|
]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"x" : [
|
"[\"j\", \"k\")",
|
"[/^j/, /^j/]"
|
]
|
},
|
"keysExamined" : 1,
|
"seeks" : 2,
|
"dupsTested" : 0,
|
"dupsDropped" : 0,
|
"seenInvalidated" : 0
|
}
|
}
|
},
|
"serverInfo" : {
|
"host" : "Asyas-MacBook-Pro.local",
|
"port" : 27017,
|
"version" : "3.5.13",
|
"gitVersion" : "52bbaa007cd84631d6da811d9a05b59f2dfad4f3"
|
},
|
"ok" : 1
|
}
|
|