MongoDB 优化器profile
生活随笔
收集整理的這篇文章主要介紹了
MongoDB 优化器profile
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、概述 >?db.system.profile.find();?? {?"ts"?:?ISODate("2014-05-05T02:45:10.359Z"),?"info"?:?"query?test.system.profile?reslen:36?nscanned:0??\nquery:?{}??nreturned:0?bytes:20",?"millis"?:?0?}?? {?"ts"?:?ISODate("2014-05-05T02:45:13.562Z"),?"info"?:?"query?test.$cmd?ntoreturn:1?command:?{?count:?\"system.profile\",?query:?{},?fields:?{}?}?reslen:64?bytes:48",?"millis"?:?0?}?? {?"ts"?:?ISODate("2014-05-05T02:45:13.562Z"),?"info"?:?"query?test.system.profile?ntoreturn:5?reslen:36?nscanned:2??\nquery:?{?query:?{?millis:?{?$gt:?0.0?}?},?orderby:?{?$natural:?-1.0?}?}??nreturned:0?bytes:20",?"millis"?:?0?}?? {?"ts"?:?ISODate("2014-05-05T02:45:17.171Z"),?"info"?:?"query?test.emp?reslen:261?nscanned:5??\nquery:?{}??nreturned:5?bytes:245",?"millis"?:?0?}?? 說明:
Mongodb profiling是Mngodb提供的類似于mysql的慢查詢的功能,用于記錄執行時間超過多少的語句,默認記錄在system.profile中。
2、開啟profiling功能
通過客戶端開啟
profile級別有三種:
0:不開啟
1:記錄慢命令,默認為大于100ms
2:記錄所有命令
3、查詢profiling記錄
[html]?view plain?copy ?print?
ts:該命令執行的時間。
info:本命令的詳細信息。
reslen:返回結果集的大小。
nscanned:本次查詢掃描的記錄數。
nretured:本次查詢時間返回的結果集。
millis:該命令執行的耗時。
總結
以上是生活随笔為你收集整理的MongoDB 优化器profile的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL 5.6版本GTID复制异常处
- 下一篇: zabbix性能优化