Skip to content

Instantly share code, notes, and snippets.

@extrawurst
Created August 22, 2020 08:31
Show Gist options
  • Save extrawurst/67b9bcb4214db0fd4992f0e5a6cbbfbd to your computer and use it in GitHub Desktop.
Save extrawurst/67b9bcb4214db0fd4992f0e5a6cbbfbd to your computer and use it in GitHub Desktop.
globaldb:PRIMARY> db.users.count({test:"TelescopeTest2",group:"Test"})
9721
globaldb:PRIMARY> db.runCommand({getLastRequestStatistics:1})
{
"CommandName" : "count",
"RequestCharge" : 1203.82,
"RequestDurationInMilliSeconds" : NumberLong(318),
"ActivityId" : "0e3e093f-9af8-459a-99ed-53113b138197",
"ok" : 1
}
globaldb:PRIMARY> db.users.explain().count({test:"TelescopeTest2",group:"Test"})
{
"stages" : [
{
"stage" : "$aggregateQuery",
"timeInclusiveMS" : 241.3663,
"timeExclusiveMS" : 0.0421,
"in" : 1,
"out" : 1,
"details" : {
"database" : "telescope",
"collection" : "users",
"query" : {
"$and" : [
{
"test" : {
"$eq" : "TelescopeTest2"
}
},
{
"group" : {
"$eq" : "Test"
}
}
]
},
"pathsIndexed" : [
"test",
"group"
],
"pathsNotIndexed" : [ ],
"aggregate" : {
"$count" : "c"
},
"shardInformation" : [
{
"activityId" : "4d2610aa-f817-4aa0-99eb-44728605a095",
"shardKeyRangeId" : "0",
"durationMS" : 227.6347,
"preemptions" : 1,
"outputDocumentCount" : 1,
"retrievedDocumentCount" : 29729
}
],
"queryMetrics" : {
"retrievedDocumentCount" : 29729,
"retrievedDocumentSizeBytes" : 14419602,
"outputDocumentCount" : 1,
"outputDocumentSizeBytes" : 46,
"indexHitRatio" : 0,
"totalQueryExecutionTimeMS" : 226.15,
"queryPreparationTimes" : {
"queryCompilationTimeMS" : 0.16,
"logicalPlanBuildTimeMS" : 0.1,
"physicalPlanBuildTimeMS" : 0.26,
"queryOptimizationTimeMS" : 0.02
},
"indexLookupTimeMS" : 0.12000000000000001,
"documentLoadTimeMS" : 153.63,
"vmExecutionTimeMS" : 225.36,
"runtimeExecutionTimes" : {
"queryEngineExecutionTimeMS" : 71.61,
"systemFunctionExecutionTimeMS" : 33.46,
"userDefinedFunctionExecutionTimeMS" : 0
},
"documentWriteTimeMS" : 0
}
}
}
],
"estimatedDelayFromRateLimitingInMilliseconds" : 0,
"continuation" : {
"hasMore" : false
},
"ok" : 1
}
globaldb:PRIMARY> db.users.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "telescope.users"
},
{
"v" : 1,
"key" : {
"test" : 1
},
"name" : "test_1",
"ns" : "telescope.users"
},
{
"v" : 1,
"key" : {
"test" : 1,
"created" : 1
},
"name" : "test_1_created_1",
"ns" : "telescope.users"
},
{
"v" : 1,
"key" : {
"test" : 1,
"group" : 1
},
"name" : "test_1_group_1",
"ns" : "telescope.users"
},
{
"v" : 1,
"unique" : true,
"key" : {
"id" : 1,
"test" : 1
},
"name" : "id_1_test_1",
"ns" : "telescope.users"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment