diff options
author | Xavier Noria <fxn@hashref.com> | 2011-12-02 04:32:18 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-12-02 04:35:43 -0800 |
commit | 0306f82e0c3cda3aad1b45eb0c3a359c254b62cc (patch) | |
tree | 08ddebf4733e3b3c2b24d4ee1db8313c4a447f71 /railties/lib/rails/generators/rails | |
parent | 4d20de8a50d889a09e6f5642984775fe796ca943 (diff) | |
download | rails-0306f82e0c3cda3aad1b45eb0c3a359c254b62cc.tar.gz rails-0306f82e0c3cda3aad1b45eb0c3a359c254b62cc.tar.bz2 rails-0306f82e0c3cda3aad1b45eb0c3a359c254b62cc.zip |
implements automatic EXPLAIN logging for slow queries
Diffstat (limited to 'railties/lib/rails/generators/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 47078e3af9..beaf941282 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -25,6 +25,10 @@ <%- unless options.skip_active_record? -%> # Raise exception on mass assignment protection for ActiveRecord models config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 <%- end -%> # Do not compress assets diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index 50f2df3d35..40ec3fc644 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -60,4 +60,10 @@ # Send deprecation notices to registered listeners config.active_support.deprecation = :notify + + <%- unless options.skip_active_record? -%> + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 + <%- end -%> end |