Inspect My SQL

by Phlip

Object-Relational Models, like Rails's ActiveRecord, help generate very complex queries. Sometimes we need that complexity - without slow execution times! We might not notice when our queries have grown beyond our databases's tuning and indices.

This post shows how to trap, interpret, and EXPLAIN SQL SELECT statements under MySQL. Our platform is Ruby on Rails, yet the lessons apply to any ORM.