Explain Rails Active Record Query

You can output the raw query for an Active Record Query by tagging .explain at the end.


EXPLAIN for: SELECT `books`.* FROM `books` WHERE `books`.`author` = 1

Very useful for complex queries where it’s hard to understand what is happening under the hood 🤯. You can read the docs for more info.

Leave a Comment