【发布时间】:2018-04-12 16:14:24
【问题描述】:
我正在尝试测量 MongoDB 中的查询运行时间。
步骤: 我在 mongoDB 中设置分析并运行我的查询 当我确实显示个人资料时,我得到了以下输出。
db.blogpost.find({post:/.* NATO .*/i})
blogpost是集合名称,我在查询中搜索了“NATO”关键字。
输出:它提取了 20 条记录,运行查询得到执行结果后,我得到以下输出:
在输出中我可以看到 3 个时间值,哪一个类似于 MySQL 中的持续时间?
query blogtrackernosql.blogpost **472ms** Wed Apr 11 2018 20:37:54
command:{
"find" : "blogpost",
"filter" : {
"post" : /.* NATO .*/i
},
"$db" : "blogtrackernosql"
} cursorid:99983342073 keysExamined:0 docsExamined:1122 numYield:19 locks:{
"Global" : {
"acquireCount" : {
"r" : NumberLong(40)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(20)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(20)
}
}
} nreturned:101 responseLength:723471 protocol:op_msg planSummary:COLLSCAN
execStats:{
**"stage"** : "COLLSCAN",
"filter" : {
"post" : {
"$regex" : ".* NATO .*",
"$options" : "i"
}
},
"nReturned" : 101,
**"executionTimeMillisEstimate" : 422**,
"works" : 1123,
"advanced" : 101,
"needTime" : 1022,
"needYield" : 0,
"saveState" : 20,
"restoreState" : 19,
"isEOF" : 0,
"invalidates" : 0,
"direction" : "forward",
"docsExamined" : 1122
} client:127.0.0.1 appName:MongoDB Shell allUsers:[ ] user:
【问题讨论】:
标签: mongodb mongodb-query query-performance