Last active
June 6, 2019 00:55
-
-
Save MuhammadJamaluddin/56d280008d744781c74a51c88e9e6c00 to your computer and use it in GitHub Desktop.
The queries are slow (in the range of 50:100 ms) & a lot of times it would even exceed the 100 ms bar although I'm using an index.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.books.find({"id": 7945640}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 7945640 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[7945640.0, 7945640.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 96, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 97, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 65, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[7945640.0, 7945640.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 2045040}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 2045040 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[2045040.0, 2045040.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 83, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 83, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 54, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[2045040.0, 2045040.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 9945340}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 9945340 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[9945340.0, 9945340.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 68, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 68, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 42, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[9945340.0, 9945340.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 9090040}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 9090040 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[9090040.0, 9090040.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 84, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 85, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 59, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[9090040.0, 9090040.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 4090040}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 4090040 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[4090040.0, 4090040.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 73, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 73, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 44, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[4090040.0, 4090040.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 7000}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 7000 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[7000.0, 7000.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 43, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 44, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 10, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[7000.0, 7000.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} | |
> db.books.find({"id": 700000}).explain("executionStats"); | |
{ | |
"queryPlanner" : { | |
"plannerVersion" : 1, | |
"namespace" : "books.books", | |
"indexFilterSet" : false, | |
"parsedQuery" : { | |
"id" : { | |
"$eq" : 700000 | |
} | |
}, | |
"winningPlan" : { | |
"stage" : "FETCH", | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[700000.0, 700000.0]" | |
] | |
} | |
} | |
}, | |
"rejectedPlans" : [ ] | |
}, | |
"executionStats" : { | |
"executionSuccess" : true, | |
"nReturned" : 1, | |
"executionTimeMillis" : 59, | |
"totalKeysExamined" : 1, | |
"totalDocsExamined" : 1, | |
"executionStages" : { | |
"stage" : "FETCH", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 59, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"docsExamined" : 1, | |
"alreadyHasObj" : 0, | |
"inputStage" : { | |
"stage" : "IXSCAN", | |
"nReturned" : 1, | |
"executionTimeMillisEstimate" : 10, | |
"works" : 2, | |
"advanced" : 1, | |
"needTime" : 0, | |
"needYield" : 0, | |
"saveState" : 1, | |
"restoreState" : 1, | |
"isEOF" : 1, | |
"invalidates" : 0, | |
"keyPattern" : { | |
"id" : 1 | |
}, | |
"indexName" : "id_1", | |
"isMultiKey" : false, | |
"multiKeyPaths" : { | |
"id" : [ ] | |
}, | |
"isUnique" : true, | |
"isSparse" : false, | |
"isPartial" : false, | |
"indexVersion" : 2, | |
"direction" : "forward", | |
"indexBounds" : { | |
"id" : [ | |
"[700000.0, 700000.0]" | |
] | |
}, | |
"keysExamined" : 1, | |
"seeks" : 1, | |
"dupsTested" : 0, | |
"dupsDropped" : 0, | |
"seenInvalidated" : 0 | |
} | |
} | |
}, | |
"serverInfo" : { | |
"host" : "DESKTOP-NDIMKI9", | |
"port" : 27017, | |
"version" : "4.0.6", | |
"gitVersion" : "caa42a1f75a56c7643d0b68d3880444375ec42e3" | |
}, | |
"ok" : 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment