A systematic guide to debugging slow database queries in Rails applications. Covers built-in Rails tools including the `explain` method (with Rails 7.1 enhancements), `load_async`, ActiveSupport::Notifications, query log tags, and strict loading mode. Also covers essential gems like Bullet, rack-mini-profiler, and prosopite. Includes database-specific tools for PostgreSQL (pg_stat_statements, PgHero, pgBadger), MySQL (Performance Schema, pt-query-digest), and SQLite (EXPLAIN QUERY PLAN). Addresses Rails 8 specifics including SQLite as a production database and Solid Cache's impact on query logs. Concludes with a five-step practical debugging workflow and production monitoring options.

6m read timeFrom blog.saeloun.com
Post cover image
Table of contents
Understanding the ProblemRails Built in ToolsEssential Gems for Query DebuggingPostgreSQL Specific ToolsMySQL Specific ToolsSQLite Specific ToolsSolid Cache and Query PerformancePractical Debugging WorkflowMonitoring in ProductionSummaryReferences

Sort: