MongoDB Enterprise > db.test.drop()
true
MongoDB Enterprise > db.test.insert({a: 1})
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise > db.test.createIndex({a: 1})
{
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"createdCollectionAutomatically" : false,
"ok" : 1
}
MongoDB Enterprise > db.test.createIndex({a: -1, b: 1})
{
"numIndexesBefore" : 2,
"numIndexesAfter" : 3,
"createdCollectionAutomatically" : false,
"ok" : 1
}
MongoDB Enterprise > db.test.explain().find({a: {$in: [1, 3]}, b: {$in: [1, 3]}}).count()
{
"explainVersion" : "1",
"queryPlanner" : {
"namespace" : "test.test",
"parsedQuery" : {
"$and" : [
{
"a" : {
"$in" : [
1,
3
]
}
},
{
"b" : {
"$in" : [
1,
3
]
}
}
]
},
"indexFilterSet" : false,
"queryHash" : "851B3812",
"planCacheShapeHash" : "851B3812",
"planCacheKey" : "1B96FA17",
"optimizationTimeMillis" : 1,
"maxIndexedOrSolutionsReached" : false,
"maxIndexedAndSolutionsReached" : false,
"maxScansToExplodeReached" : false,
"prunedSimilarIndexes" : false,
"winningPlan" : {
"isCached" : false,
"stage" : "COUNT",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"a" : -1,
"b" : 1
},
"indexName" : "a_-1_b_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"a" : [ ],
"b" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"a" : [
"[3.0, 3.0]",
"[1.0, 1.0]"
],
"b" : [
"[1.0, 1.0]",
"[3.0, 3.0]"
]
}
}
},
"rejectedPlans" : [
{
"isCached" : false,
"stage" : "COUNT",
"inputStage" : {
"stage" : "FETCH",
"filter" : {
"b" : {
"$in" : [
1,
3
]
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"a" : 1
},
"indexName" : "a_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"a" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"a" : [
"[1.0, 1.0]",
"[3.0, 3.0]"
]
}
}
}
}
]
},
"command" : {
"count" : "test",
"query" : {
"a" : {
"$in" : [
1,
3
]
},
"b" : {
"$in" : [
1,
3
]
}
}
},
"serverInfo" : {
"host" : "ip-10-122-11-12",
"port" : 27017,
"version" : "8.3.0-alpha0",
"gitVersion" : "nogitversion"
},
"serverParameters" : {
"internalQueryFacetBufferSizeBytes" : 104857600,
"internalDocumentSourceGroupMaxMemoryBytes" : 104857600,
"internalQueryMaxBlockingSortMemoryUsageBytes" : 104857600,
"internalDocumentSourceSetWindowFieldsMaxMemoryBytes" : 104857600,
"internalQueryFacetMaxOutputDocSizeBytes" : 104857600,
"internalLookupStageIntermediateDocumentMaxSizeBytes" : 104857600,
"internalQueryProhibitBlockingMergeOnMongoS" : 0,
"internalQueryMaxAddToSetBytes" : 104857600,
"internalQueryFrameworkControl" : "trySbeRestricted",
"internalQueryPlannerIgnoreIndexWithCollationForRegex" : 1
},
"ok" : 1
}
MongoDB Enterprise > db.adminCommand({setParameter: 1, planRankerMode: "samplingCE"})
{ "was" : "multiPlanning", "ok" : 1 }
MongoDB Enterprise > db.test.explain().find({a: {$in: [1, 3]}, b: {$in: [1, 3]}}).count()
{
"explainVersion" : "1",
"queryPlanner" : {
"namespace" : "test.test",
"parsedQuery" : {
"$and" : [
{
"a" : {
"$in" : [
1,
3
]
}
},
{
"b" : {
"$in" : [
1,
3
]
}
}
]
},
"indexFilterSet" : false,
"queryHash" : "851B3812",
"planCacheShapeHash" : "851B3812",
"planCacheKey" : "1B96FA17",
"optimizationTimeMillis" : 0,
"maxIndexedOrSolutionsReached" : false,
"maxIndexedAndSolutionsReached" : false,
"maxScansToExplodeReached" : false,
"prunedSimilarIndexes" : false,
"winningPlan" : {
"isCached" : false,
"stage" : "COUNT",
"inputStage" : {
"stage" : "IXSCAN",
"costEstimate" : 0.0144587,
"cardinalityEstimate" : 0,
"numKeysEstimate" : 1,
"estimatesMetadata" : {
"ceSource" : "Sampling"
},
"keyPattern" : {
"a" : -1,
"b" : 1
},
"indexName" : "a_-1_b_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"a" : [ ],
"b" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"a" : [
"[3.0, 3.0]",
"[1.0, 1.0]"
],
"b" : [
"[1.0, 1.0]",
"[3.0, 3.0]"
]
}
}
},
"rejectedPlans" : [
{
"isCached" : false,
"stage" : "FETCH",
"costEstimate" : 0.0234674,
"cardinalityEstimate" : 0,
"estimatesMetadata" : {
"ceSource" : "Sampling"
},
"filter" : {
"b" : {
"$in" : [
1,
3
]
}
},
"inputStage" : {
"stage" : "IXSCAN",
"costEstimate" : 0.0144587,
"cardinalityEstimate" : 1,
"numKeysEstimate" : 1,
"estimatesMetadata" : {
"ceSource" : "Sampling"
},
"keyPattern" : {
"a" : 1
},
"indexName" : "a_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"a" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"a" : [
"[1.0, 1.0]",
"[3.0, 3.0]"
]
}
}
}
]
},
"command" : {
"count" : "test",
"query" : {
"a" : {
"$in" : [
1,
3
]
},
"b" : {
"$in" : [
1,
3
]
}
}
},
"serverInfo" : {
"host" : "ip-10-122-11-12",
"port" : 27017,
"version" : "8.3.0-alpha0",
"gitVersion" : "nogitversion"
},
"serverParameters" : {
"internalQueryFacetBufferSizeBytes" : 104857600,
"internalDocumentSourceGroupMaxMemoryBytes" : 104857600,
"internalQueryMaxBlockingSortMemoryUsageBytes" : 104857600,
"internalDocumentSourceSetWindowFieldsMaxMemoryBytes" : 104857600,
"internalQueryFacetMaxOutputDocSizeBytes" : 104857600,
"internalLookupStageIntermediateDocumentMaxSizeBytes" : 104857600,
"internalQueryProhibitBlockingMergeOnMongoS" : 0,
"internalQueryMaxAddToSetBytes" : 104857600,
"internalQueryFrameworkControl" : "trySbeRestricted",
"internalQueryPlannerIgnoreIndexWithCollationForRegex" : 1
},
"ok" : 1
}
MongoDB Enterprise >