Skip to content

Instantly share code, notes, and snippets.

@batara666
Created August 31, 2020 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batara666/e6c1321fba176d32ff74dd986442bd26 to your computer and use it in GitHub Desktop.
Save batara666/e6c1321fba176d32ff74dd986442bd26 to your computer and use it in GitHub Desktop.
explain
> db.chat.find({text: /putin/i, "timestamp": {"$gt":1590969600, "$lt": 1598832000}}).explain("allPlansExecution")
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "social_data.chat",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"timestamp" : {
"$lt" : 1598832000
}
},
{
"timestamp" : {
"$gt" : 1590969600
}
},
{
"text" : {
"$regex" : "putin",
"$options" : "i"
}
}
]
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"keyPattern" : {
"timestamp" : 1,
"text" : 1,
"room_id" : 1,
"spam" : 1
},
"indexName" : "timestamp_1_text_1_room_id_1_spam_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"timestamp" : [ ],
"text" : [ ],
"room_id" : [ ],
"spam" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"timestamp" : [
"(1590969600.0, 1598832000.0)"
],
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"room_id" : [
"[MinKey, MaxKey]"
],
"spam" : [
"[MinKey, MaxKey]"
]
}
}
},
"rejectedPlans" : [
{
"stage" : "FETCH",
"filter" : {
"$and" : [
{
"timestamp" : {
"$lt" : 1598832000
}
},
{
"timestamp" : {
"$gt" : 1590969600
}
}
]
},
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"keyPattern" : {
"text" : 1
},
"indexName" : "text_find",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
]
}
}
},
{
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"keyPattern" : {
"text" : 1,
"timestamp" : -1,
"room_id" : 1
},
"indexName" : "serveDashboardDyn",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ],
"timestamp" : [ ],
"room_id" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"timestamp" : [
"(1598832000.0, 1590969600.0)"
],
"room_id" : [
"[MinKey, MaxKey]"
]
}
}
},
{
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"keyPattern" : {
"text" : 1,
"room_id" : 1,
"timestamp" : -1
},
"indexName" : "keyword & room_id",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ],
"room_id" : [ ],
"timestamp" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"room_id" : [
"[MinKey, MaxKey]"
],
"timestamp" : [
"(1598832000.0, 1590969600.0)"
]
}
}
}
]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 36562,
"executionTimeMillis" : 5279,
"totalKeysExamined" : 1983473,
"totalDocsExamined" : 36562,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 36562,
"executionTimeMillisEstimate" : 2741,
"works" : 1983473,
"advanced" : 36562,
"needTime" : 1946910,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 1,
"docsExamined" : 36562,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"nReturned" : 36562,
"executionTimeMillisEstimate" : 2670,
"works" : 1983473,
"advanced" : 36562,
"needTime" : 1946910,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 1,
"keyPattern" : {
"timestamp" : 1,
"text" : 1,
"room_id" : 1,
"spam" : 1
},
"indexName" : "timestamp_1_text_1_room_id_1_spam_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"timestamp" : [ ],
"text" : [ ],
"room_id" : [ ],
"spam" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"timestamp" : [
"(1590969600.0, 1598832000.0)"
],
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"room_id" : [
"[MinKey, MaxKey]"
],
"spam" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 1983473,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0
}
},
"allPlansExecution" : [
{
"nReturned" : 101,
"executionTimeMillisEstimate" : 1,
"totalKeysExamined" : 9788,
"totalDocsExamined" : 101,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 101,
"executionTimeMillisEstimate" : 1,
"works" : 9788,
"advanced" : 101,
"needTime" : 9687,
"needYield" : 0,
"saveState" : 305,
"restoreState" : 305,
"isEOF" : 0,
"docsExamined" : 101,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"nReturned" : 101,
"executionTimeMillisEstimate" : 1,
"works" : 9788,
"advanced" : 101,
"needTime" : 9687,
"needYield" : 0,
"saveState" : 305,
"restoreState" : 305,
"isEOF" : 0,
"keyPattern" : {
"timestamp" : 1,
"text" : 1,
"room_id" : 1,
"spam" : 1
},
"indexName" : "timestamp_1_text_1_room_id_1_spam_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"timestamp" : [ ],
"text" : [ ],
"room_id" : [ ],
"spam" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"timestamp" : [
"(1590969600.0, 1598832000.0)"
],
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"room_id" : [
"[MinKey, MaxKey]"
],
"spam" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 9788,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0
}
}
},
{
"nReturned" : 0,
"executionTimeMillisEstimate" : 1,
"totalKeysExamined" : 9788,
"totalDocsExamined" : 0,
"executionStages" : {
"stage" : "FETCH",
"filter" : {
"$and" : [
{
"timestamp" : {
"$lt" : 1598832000
}
},
{
"timestamp" : {
"$gt" : 1590969600
}
}
]
},
"nReturned" : 0,
"executionTimeMillisEstimate" : 1,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"docsExamined" : 0,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"nReturned" : 0,
"executionTimeMillisEstimate" : 1,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"keyPattern" : {
"text" : 1
},
"indexName" : "text_find",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
]
},
"keysExamined" : 9788,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0
}
}
},
{
"nReturned" : 0,
"executionTimeMillisEstimate" : 0,
"totalKeysExamined" : 9788,
"totalDocsExamined" : 0,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 0,
"executionTimeMillisEstimate" : 0,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"docsExamined" : 0,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"nReturned" : 0,
"executionTimeMillisEstimate" : 0,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"keyPattern" : {
"text" : 1,
"timestamp" : -1,
"room_id" : 1
},
"indexName" : "serveDashboardDyn",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ],
"timestamp" : [ ],
"room_id" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"timestamp" : [
"(1598832000.0, 1590969600.0)"
],
"room_id" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 9788,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0
}
}
},
{
"nReturned" : 0,
"executionTimeMillisEstimate" : 2,
"totalKeysExamined" : 9788,
"totalDocsExamined" : 0,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 0,
"executionTimeMillisEstimate" : 2,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"docsExamined" : 0,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"filter" : {
"text" : {
"$regex" : "putin",
"$options" : "i"
}
},
"nReturned" : 0,
"executionTimeMillisEstimate" : 2,
"works" : 9788,
"advanced" : 0,
"needTime" : 9788,
"needYield" : 0,
"saveState" : 15726,
"restoreState" : 15726,
"isEOF" : 0,
"keyPattern" : {
"text" : 1,
"room_id" : 1,
"timestamp" : -1
},
"indexName" : "keyword & room_id",
"isMultiKey" : false,
"multiKeyPaths" : {
"text" : [ ],
"room_id" : [ ],
"timestamp" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"text" : [
"[\"\", {})",
"[/putin/i, /putin/i]"
],
"room_id" : [
"[MinKey, MaxKey]"
],
"timestamp" : [
"(1598832000.0, 1590969600.0)"
]
},
"keysExamined" : 9788,
"seeks" : 188,
"dupsTested" : 0,
"dupsDropped" : 0
}
}
}
]
},
"serverInfo" : {
"host" : "social-db",
"port" : 28018,
"version" : "4.2.8",
"gitVersion" : "43d25964249164d76d5e04dd6cf38f6111e21f5f"
},
"ok" : 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment