Module: ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements

Defined in:
lib/activerecord-analyze/main.rb

Instance Method Summary collapse

Instance Method Details

#analyze(arel, binds = [], opts = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/activerecord-analyze/main.rb', line 5

def analyze(arel, binds = [], opts = {})
  opts_sql = ActiveRecordAnalyze.build_prefix(opts)

  sql = "EXPLAIN #{opts_sql} #{to_sql(arel, binds)}"
  PostgreSQL::ExplainPrettyPrinter.new.pp(exec_query(sql, "EXPLAIN #{opts_sql}".strip, binds))
end