Reputation: 2575
I have annoying problem with SHOW TABLES in my Rails 2.3.2 APP - it is slowing my APP very deep. The question is, how to get rid of SHOW TABLES usage and where it is used in Rails framework? From APP logs I can see that it is being used all the time.
Thank you!
config/environments/production.rb:
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
Upvotes: 0
Views: 707
Reputation: 13724
I was seeing a similar problem in Rails 3.0 and was able to fix it using the gist pointed to from this issue. Looks like it's fixed in Rails 3.2.
I added ar_patch.rb to config/initializers with this code:
unless Rails.env.development?
require "active_record/connection_adapters/mysql2_adapter"
module ActiveRecord
module ConnectionAdapters
class Mysql2Adapter < AbstractAdapter
extend ActiveSupport::Memoizable
memoize :tables, :pk_and_sequence_for, :columns
end
end
end
end
Upvotes: 0
Reputation: 15530
"SHOW TABLES" is ORM-dependent SQL query, it fires with every action to provide classes reload in development mode. How much time does the query take?
Upvotes: 0