LoginSignup
14
15

More than 5 years have passed since last update.

mongoDBのスロークエリ検出

Last updated at Posted at 2014-06-04

mongodコマンドに--slowmsオプションを付けて起動する。
オプションの後に数字を与えると、しきい値を変更できる。デフォルトは100(ms)。

$ mongod --slowms <millisec>

スロークエリがある場合はログに出力される。

ログに出力されたクエリをmongo shellでexplain()してみると、indexを使わないで検索してたりすることが分かる。

$ mongo
> db.collection.find().explain()
14
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
15