Class: ActiveRecord::ConnectionAdapters::SQLite3::ExplainPrettyPrinter

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#pp(result) ⇒ Object

Pretty prints the result of an EXPLAIN QUERY PLAN in a way that resembles the output of the SQLite shell:

0|0|0|SEARCH TABLE users USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)
0|1|1|SCAN TABLE posts (~100000 rows)

11
12
13
14
15
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb', line 11

def pp(result)
  result.rows.map do |row|
    row.join('|')
  end.join("\n") + "\n"
end