Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto_explain_threshold_in_seconds

I am getting below given message while running WEBrick.

auto_explain_threshold_in_seconds is set but will be ignored because your adapter does not support this feature. Please unset the configuration to avoid this warning.

I am using:

gem 'rails', '3.2.13'
gem 'mysql'

WEBrick 1.3.1
ruby 1.9.3 (2013-02-22) [i386-mingw32]

Can somebody help me knowing - why i am getting this and how to solve it ?

like image 925
Syed Avatar asked Apr 08 '13 02:04

Syed


2 Answers

I came across this error message today in Rails 3 app I was upgrading to 3.2.

config/environments/development.rb

Commented out this line and it will work:

config.active_record.auto_explain_threshold_in_seconds = 0.5

above that line it said:

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)

and I was using MySQL so I don't really know why it was throwing an error. Hope this helps!

like image 175
Stratus3D Avatar answered Nov 13 '22 17:11

Stratus3D


As noted, you could comment out the config, and the error would go away, but it is trying to tell you that you have a slow query, and you'd probably want to know what's going on there.

It should work if you try the mysql2 gem instead of the mysql gem.

This seems like a duplicate of undefined method `explain' for #<ActiveRecord::ConnectionAdapters::MysqlAdapter

UPDATE: As @twelve17 noted, the presence of this message in the log doesn't mean that you have a slow query yet, but that your adapter doesn't support the mechanism this uses to tell you when you do have a slow query. I should have said "You don't want to just turn this functionality off, you'd probably want to use the mysql2 gem so you can see when a slow query comes up"

like image 45
J_McCaffrey Avatar answered Nov 13 '22 16:11

J_McCaffrey