# File lib/new_relic/agent/instrumentation/active_record_subscriber.rb, line 42 def get_explain_plan(statement) connection = NewRelic::Agent::Database.get_connection(statement.config) do ::ActiveRecord::Base.send("#{statement.config[:adapter]}_connection", statement.config) end if connection && connection.respond_to?(:exec_query) return connection.exec_query("EXPLAIN #{statement.sql}", "Explain #{statement.name}", statement.binds) end rescue => e NewRelic::Agent.logger.debug "Couldn't fetch the explain plan for #{statement} due to #{e}" end