class ActiveRecord::ConnectionAdapters::MySQL::ExplainPrettyPrinter
def pp(result, elapsed)
2 rows in set (0.00 sec)
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
| 1 | SIMPLE | posts | ALL | NULL | NULL | NULL | NULL | 1 | Using where |
| 1 | SIMPLE | users | const | PRIMARY | PRIMARY | 4 | const | 1 | |
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
MySQL shell:
Pretty prints the result of an EXPLAIN in a way that resembles the output of the
:nodoc:
def pp(result, elapsed) widths = compute_column_widths(result) separator = build_separator(widths) pp = [] pp << separator pp << build_cells(result.columns, widths) pp << separator result.rows.each do |row| pp << build_cells(row, widths) end pp << separator pp << build_footer(result.rows.length, elapsed) pp.join("\n") + "\n" end