Identifying slow Rails queries with sqlcommenter
Jun 29, 2022Mike Coutermarsh, Iheanyi Ekechukwu

Summary
This post introduces the integration of the sqlcommenter format with Rails applications, building upon the native query commenting features in Rails 7. It details how to enable sqlcommenter using the `activerecord-sql_commenter` gem and configure Rails query log tags. The primary contribution is demonstrating how these enhanced query comments, when used with PlanetScale Query Insights, allow for more precise identification and resolution of slow queries by providing richer context for performance monitoring.