|
RY> db.tblbooks.validate();
{
"ns" : "snow.tblbooks",
"datasize" : 336,
"nrecords" : 3,
"lastExtentSize" : 8192,
"firstExtent" : "0:5000 ns:snow.tblbooks",
"lastExtent" : "0:5000 ns:snow.tblbooks",
"extentCount" : 1,
"firstExtentDetails" : {
"loc" : "0:5000",
"xnext" : "null",
"xprev" : "null",
"nsdiag" : "snow.tblbooks",
"size" : 8192,
"firstRecord" : "0:50b0",
"lastRecord" : "0:51b0"
},
"deletedCount" : 1,
"deletedSize" : 7632,
"nIndexes" : 1,
"keysPerIndex" : {
"snow.tblbooks.$_id_" : 3
},
"valid" : true,
"errors" : [ ],
"warning" : "Some checks omitted for speed. use {full:true} option to do more thorough scan.",
"ok" : 1
}
wind:PRIMARY>
wind:PRIMARY> db.tblbooks.validate(true);
{
"ns" : "snow.tblbooks",
"datasize" : 336,
"nrecords" : 3,
"lastExtentSize" : 8192,
"firstExtent" : "0:5000 ns:snow.tblbooks",
"lastExtent" : "0:5000 ns:snow.tblbooks",
"extentCount" : 1,
"extents" : [
{
"loc" : "0:5000",
"xnext" : "null",
"xprev" : "null",
"nsdiag" : "snow.tblbooks",
"size" : 8192,
"firstRecord" : "0:50b0",
"lastRecord" : "0:51b0"
}
],
"firstExtentDetails" : {
"loc" : "0:5000",
"xnext" : "null",
"xprev" : "null",
"nsdiag" : "snow.tblbooks",
"size" : 8192,
"firstRecord" : "0:50b0",
"lastRecord" : "0:51b0"
},
"objectsFound" : 3,
"invalidObjects" : 0,
"nQuantizedSize" : 3,
"bytesWithHeaders" : 384,
"bytesWithoutHeaders" : 336,
"bytesBson" : 263,
"deletedCount" : 1,
"deletedSize" : 7632,
"delBucketSizes" : [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"nIndexes" : 1,
"keysPerIndex" : {
"snow.tblbooks.$_id_" : 3
},
"indexDetails" : {
"snow.tblbooks.$_id_" : {
}
},
"valid" : true,
"errors" : [ ],
"ok" : 1
}
---5.剖析mongodb主要解决数据库慢的性能问题
剖析等级:
0:不剖析
1:只剖析速度慢的操作
2:剖析所有操作
wind:PRIMARY> use snow;
switched to db snow
wind:PRIMARY> show tables;
system.indexes
tblbooks
wind:PRIMARY> db.runCommand({profile:2,slows:100});
{ "was" : 0, "slowms" : 100, "ok" : 1 }
wind:PRIMARY> db.tblbooks.find();
{ "_id" : ObjectId("55c069cf0bef81df34afc6d3"), "orderno" : "1001", "pname" : "jinri", "scity" : "pek", "price" : 1650 }
{ "_id" : ObjectId("55c06dcd1449f1bbe0a56e9b"), "orderno" : "1002", "pname" : "jinri", "scity" : "pvg", "price" : 1750 }
{ "_id" : ObjectId("55c0701c9ee8e3a9b7f8109f"), "orderno" : "1189", "pname" : "ocpyang", "scity" : "ctu", "price" : 780 }
wind:PRIMARY> db.system.profile.find();
{ "op" : "query", "ns" : "snow.tblbooks", "query" : { }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 0, "nscannedObjects" : 3, "keyUpdates" : 0, "writeConflicts" : 0, "numYield" : 0, "locks" : { "Global" : { "acquireCount" : { "r" : NumberLong(2) } }, "MMAPV1Journal" : { "acquireCount" : { "r" : NumberLong(1) } }, "Database" : { "acquireCount" : { "r" : NumberLong(1) } }, "Collection" : { "acquireCount" : { "R" : NumberLong(1) } } }, "nreturned" : 3, "responseLength" : 283, "millis" : 0, "execStats" : { "stage" : "COLLSCAN", "filter" : { "$and" : [ ] }, "nReturned" : 3, "executionTimeMillisEstimate" : 0, "works" : 5, "advanced" : 3, "needTime" : 1, "needFetch" : 0 |