Assert Efficient Sql

last modified: January 13, 2008

An ActiveRecord assertion (delivered as a RubyOnRails plugin) that detects inefficient MySql SELECT statements.

See http://efficient-sql.rubyforge.org/

To ensure your test cases call efficient MySQL…

def test_my_case
  assert_efficient_sql do
    # just wrap them in this block!
  end
end

The assertion intercepts and copies out your MySQL SELECT statements, then calls EXPLAIN on each one, and inspects the results for common problems.

See also http://www.oreillynet.com/ruby/blog/2008/01/assert_efficient_sql.html


Loading...