查看一次mongodb查询所耗费的时间
巴扎黑
巴扎黑 2017-05-02 09:23:30
0
1
415

在命令行中操作mongodb,db.testrests.find({})要想知道这条语句的时间,要怎么查看那?

巴扎黑
巴扎黑

répondre à tous(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()
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!