LoginSignup
19
19

More than 5 years have passed since last update.

[rails]重いSQLクエリが走った際の自動explain表示の閾値変更

Posted at

今更ながら重いSQLクエリが走った際にログにSQLのexplainが走るのを知ったのでメモ。
開発環境などでより小さな閾値でexplain表示させたい場合は下記設定を変えればいいみたい。

config/environments/development.rb
config.active_record.auto_explain_threshold_in_seconds = 0.5

デフォルトで0.5とかなっているので0.1とかにすると100msを超えるクエリが走った際にexplainで教えてくれる。

19
19
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
19
19