-
Type:
Improvement
-
Resolution: Done
-
Priority:
Critical - P2
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
As we know, Mongodb Profiler can monitor collection slow queries and save them into db.system.profile collection. Also we can query this collection to get slow query, but I found the INSERT query in Profiler collection isn't saved very clear like
db.users.insert({ user_id: "bcd001", age: 45, status: "A" })
statement.
{
"op" : "insert",
"ns" : "",
"ninserted" : 1,
"keyUpdates" : 0,
"numYield" : 0,
"lockStats" : {
"timeLockedMicros" : {
"r" : NumberLong(0),
"w" : NumberLong(29607820)
},
"timeAcquiringMicros" : {
"r" : NumberLong(0),
"w" : NumberLong(18)
}
},
"millis" : 14804,
"ts" : ISODate("2014-05-05T07:11:19.097Z"),
"client" : "",
"allUsers" : [
{
"user" : "",
"userSource" : ""
}
],
"user" : ""
}
And the QUERY query is changed to a JSON format data, not the raw statment.
{
"op" : "query",
"ns" : "",
"query" : {
"expireAfterSeconds" : {
"$exists" : true
}
},
"ntoreturn" : 0,
"ntoskip" : 0,
"nscanned" : 20,
"keyUpdates" : 0,
"numYield" : 0,
"lockStats" : {
"timeLockedMicros" : {
"r" : NumberLong(153343),
"w" : NumberLong(0)
},
"timeAcquiringMicros" : {
"r" : NumberLong(1),
"w" : NumberLong(5)
}
},
"nreturned" : 0,
"responseLength" : 20,
"millis" : 153,
"ts" : ISODate("2014-07-12T22:09:00.696Z"),
"client" : "",
"allUsers" : [],
"user" : ""
}
So, how to get the detail slow query raw statement. Any ideas is appreciated. Thanks.