Database Reference
In-Depth Information
Finding Slow Queries
A typical record in the
system.profile
collection looks like this:
> db.system.profile.find()
{
"op" : "query",
"ns" : "blog.system.profile",
"query" : {
},
"ntoreturn" : 0,
"ntoskip" : 0,
"nscanned" : 1,
"keyUpdates" : 0,
"numYield" : 0,
"lockStats" : {
"timeLockedMicros" : {
"r" : NumberLong(60),
"w" : NumberLong(0)
},
"timeAcquiringMicros" : {
"r" : NumberLong(4),
"w" : NumberLong(3)
}
},
"nreturned" : 1,
"responseLength" : 370,
"millis" : 12,
"ts" : ISODate("2013-05-18T05:40:27.106Z"),
"client" : "127.0.0.1",
"user" : ""
}
Each record contains fields, and the following list outlines what they are and what they do:
op:
Displays the type of operation; it can be either query, insert, update, command, or delete.
•
query:
The query being run.
•
ns:
The full namespace this query was run against.
•
ntoreturn
: The number of documents to return,
•
nscanned
: The number of index entries scanned to return this document.
•
ntoskip
: The number of documents skipped.
•
keyUpdates
: The number of index keys updated by this query.
•
numYields
: The number of times this query yielded its lock to another query.
•
lockStats
: The number of microseconds spent acquiring or in the read and write locks for
this database.
•
nreturned
: The number of documents returned.
•