Hi,
We’re using M10 (General) - Replica Set - 3 nodes
With this query:
db.contacts.explain("executionStats").aggregate(
[
{
"$match": {
"accountId": 158,
"deleted": null
}
},
{
"$group": {
"_id": 1,
"n": {
"$sum": 1
}
}
}
]
)
The result is:
{
"serverInfo" : {
"host" : "<removed>",
"port" : 27017.0,
"version" : "3.6.17",
"gitVersion" : "3d6953c361213c5bfab23e51ab274ce592edafe6"
},
"stages" : [
{
"$cursor" : {
"query" : {
"accountId" : 158.0,
"deleted" : null
},
"queryPlanner" : {
"plannerVersion" : 1.0,
"namespace" : "Loopify.contacts",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"accountId" : {
"$eq" : 158.0
}
},
{
"deleted" : {
"$eq" : null
}
}
]
},
"winningPlan" : {
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0,
"tagGroups.name" : 1.0,
"tagGroups.tags" : 1.0,
"firstName" : 1.0,
"lastName" : 1.0
},
"indexName" : "accountId_1_deleted_1_tagGroups.name_1_tagGroups.tags_1_firstName_1_lastName_1",
"isMultiKey" : true,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
],
"tagGroups.name" : [
"tagGroups"
],
"tagGroups.tags" : [
"tagGroups",
"tagGroups.tags"
],
"firstName" : [
],
"lastName" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
],
"tagGroups.name" : [
"[MinKey, MaxKey]"
],
"tagGroups.tags" : [
"[MinKey, MaxKey]"
],
"firstName" : [
"[MinKey, MaxKey]"
],
"lastName" : [
"[MinKey, MaxKey]"
]
}
}
},
"rejectedPlans" : [
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"mobile" : 1.0
},
"indexName" : "accountId_1_mobile_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"mobile" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"mobile" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"email" : 1.0
},
"indexName" : "accountId_1_email_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"email" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"email" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"_id" : 1.0
},
"indexName" : "accountId_1__id_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"_id" : [
]
},
"isUnique" : true,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"_id" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0
},
"indexName" : "accountId_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0,
"firstName" : 1.0,
"lastName" : 1.0
},
"indexName" : "accountId_1_deleted_1_firstName_1_lastName_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
],
"firstName" : [
],
"lastName" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
],
"firstName" : [
"[MinKey, MaxKey]"
],
"lastName" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"firstName" : 1.0,
"lastName" : 1.0
},
"indexName" : "accountId_1_firstName_1_lastName_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"firstName" : [
],
"lastName" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"firstName" : [
"[MinKey, MaxKey]"
],
"lastName" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"externalId" : 1.0,
"deleted" : 1.0
},
"indexName" : "accountId_1_externalId_1_deleted_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"externalId" : [
],
"deleted" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"externalId" : [
"[MinKey, MaxKey]"
],
"deleted" : [
"[null, null]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0,
"tagGroups.name" : 1.0,
"tagGroups.tags" : 1.0
},
"indexName" : "accountId_1_deleted_1_tagGroups.name_1_tagGroups.tags_1",
"isMultiKey" : true,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
],
"tagGroups.name" : [
"tagGroups"
],
"tagGroups.tags" : [
"tagGroups",
"tagGroups.tags"
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
],
"tagGroups.name" : [
"[MinKey, MaxKey]"
],
"tagGroups.tags" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0
},
"indexName" : "accountId_1_deleted_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
]
}
}
},
{
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0,
"_id" : 1.0,
"firstName" : 1.0,
"lastName" : 1.0
},
"indexName" : "accountId_1_deleted_1__id_1_firstName_1_lastName_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
],
"_id" : [
],
"firstName" : [
],
"lastName" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
],
"_id" : [
"[MinKey, MaxKey]"
],
"firstName" : [
"[MinKey, MaxKey]"
],
"lastName" : [
"[MinKey, MaxKey]"
]
}
}
}
]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 153151.0,
"executionTimeMillis" : 48409.0,
"totalKeysExamined" : 6319057.0,
"totalDocsExamined" : 153151.0,
"executionStages" : {
"stage" : "FETCH",
"filter" : {
"deleted" : {
"$eq" : null
}
},
"nReturned" : 153151.0,
"executionTimeMillisEstimate" : 46454.0,
"works" : 6319058.0,
"advanced" : 153151.0,
"needTime" : 6165906.0,
"needYield" : 0.0,
"saveState" : 49917.0,
"restoreState" : 49917.0,
"isEOF" : 1.0,
"invalidates" : 0.0,
"docsExamined" : 153151.0,
"alreadyHasObj" : 0.0,
"inputStage" : {
"stage" : "IXSCAN",
"nReturned" : 153151.0,
"executionTimeMillisEstimate" : 14458.0,
"works" : 6319058.0,
"advanced" : 153151.0,
"needTime" : 6165906.0,
"needYield" : 0.0,
"saveState" : 49917.0,
"restoreState" : 49917.0,
"isEOF" : 1.0,
"invalidates" : 0.0,
"keyPattern" : {
"accountId" : 1.0,
"deleted" : 1.0,
"tagGroups.name" : 1.0,
"tagGroups.tags" : 1.0,
"firstName" : 1.0,
"lastName" : 1.0
},
"indexName" : "accountId_1_deleted_1_tagGroups.name_1_tagGroups.tags_1_firstName_1_lastName_1",
"isMultiKey" : true,
"multiKeyPaths" : {
"accountId" : [
],
"deleted" : [
],
"tagGroups.name" : [
"tagGroups"
],
"tagGroups.tags" : [
"tagGroups",
"tagGroups.tags"
],
"firstName" : [
],
"lastName" : [
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2.0,
"direction" : "forward",
"indexBounds" : {
"accountId" : [
"[158.0, 158.0]"
],
"deleted" : [
"[null, null]"
],
"tagGroups.name" : [
"[MinKey, MaxKey]"
],
"tagGroups.tags" : [
"[MinKey, MaxKey]"
],
"firstName" : [
"[MinKey, MaxKey]"
],
"lastName" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 6319057.0,
"seeks" : 1.0,
"dupsTested" : 6319057.0,
"dupsDropped" : 6165906.0,
"seenInvalidated" : 0.0
}
}
}
}
},
{
"$group" : {
"_id" : {
"$const" : 1.0
},
"n" : {
"$sum" : {
"$const" : 1.0
}
}
}
}
],
"ok" : 1.0,
"operationTime" : Timestamp(1583831635, 28),
"$clusterTime" : {
"clusterTime" : Timestamp(1583831635, 28),
"signature" : {
"hash" : BinData(0, "higLMSwtyXkmzuObjj6EgAsotPk="),
"keyId" : 6748499292626878465
}
}
}