问题描述
在命令行中操作mongodb,db.testrests.find({})要想知道这条语句的时间,要怎么查看那?
问题解答
回答1:1、find操作请直接使用explain,例如:
db.tablename.find().explain( 'executionStats' )关注输出的如下数值:explain.executionStats.executionTimeMillis
2、Update/delete/insert操作,请设置profile,然后查看日志,例如:
db.setProfilingLevel(2)db.getProfilingLevel()db.system.profile.find()

