-
-
Save alpenfritz/98b981581560408a0dc52fb7a8b02ba1 to your computer and use it in GitHub Desktop.
Revisions
-
rantav revised this gist
Aug 25, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,8 @@ This presents a histogram of slow collections Histogram of the slowest collections (collections with the slowest queries) - number of millies spent in each collection --- > db.system.profile.group({key: {ns: true}, initial: {millis: 0}, reduce: function(obj, prev){ prev.millis += obj.millis;}}) Find the most recent slow query --- -
rantav revised this gist
Aug 25, 2012 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,14 +10,23 @@ First, you have to enable profiling Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target... Histogram of the slowest collections (collections with the slowest queries) - number of queries per collection --- This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}) Histogram of the slowest collections (collections with the slowest queries) - number of millies spent in each collection --- > db.system.profile.group({key: {ns: true}, initial: {millis: 0}, reduce: function(obj, prev){ prev.millis += obj.millis;}}) Find the most recent slow query --- > db.system.profile.find().sort({$natural: -1}).limit(1) Find the single slowest query in the capped system.profile collection right now --- > db.system.profile.find().sort({millis: -1}).limit(1) -
rantav revised this gist
Aug 25, 2012 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ A few show tricks to find slow queries in mongodb === Enable profiling --- First, you have to enable profiling > db.setProfilingLevel(1) @@ -10,7 +11,7 @@ Now let it run for a while. It collects the slow queries ( > 100ms) into a cappe Find the slowest collections (collections with the slowest queries) --- This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}) -
rantav revised this gist
Aug 25, 2012 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,12 +9,14 @@ First, you have to enable profiling Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target... Find the slowest collections (collections with the slowest queries) === This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}) Find the most recent slow query --- > db.system.profile.find().sort({$natural: -1}).limit(1) -
rantav revised this gist
Aug 25, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ A few show tricks to find slow queries in mongodb Enable profiling ============== First, you have to enable profiling > db.setProfilingLevel(1) -
rantav revised this gist
Aug 25, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ A few show tricks to find slow queries in mongodb =Enable profiling First, you have to enable profiling > db.setProfilingLevel(1) -
rantav revised this gist
Aug 25, 2012 . 2 changed files with 19 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ A few show tricks to find slow queries in mongodb == Enable profiling First, you have to enable profiling > db.setProfilingLevel(1) Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target... == Find the slowest collections (collections with the slowest queries) This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}) == Find the most recent slow query > db.system.profile.find().sort({$natural: -1}).limit(1) 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +0,0 @@ -
rantav revised this gist
Aug 23, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ // then find the slowest collections (collections with the slowest queries) // This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}) // find the most recent slow query: > db.system.profile.find().sort({$natural: -1}).limit(1) -
rantav revised this gist
Aug 23, 2012 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,8 @@ // let it run for a while // then find the slowest collections (collections with the slowest queries) // This presents a histogram of slow collections > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}} // find the most recent slow query: > db.system.profile.find().sort({$natural: -1}).limit(1) -
rantav revised this gist
Aug 23, 2012 . 2 changed files with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ // enable profiling > db.setProfilingLevel(1) // let it run for a while // then find the slowest collections (collections with the slowest queries) > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}} -
rantav created this gist
Aug 23, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ > db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}}