What problem does it solve?
This Skill helps Rails teams quickly identify PostgreSQL performance issues in a Rails codebase, including slow queries, N+1 problems, missing indexes, and suboptimal configurations. It delivers actionable recommendations to optimize database performance and reliability.
Core Features & Use Cases
- N+1 Query Detection: Analyze controllers, views and models to surface N+1 patterns and suggest eager loading strategies.
- Index Opportunity Identification: Inspect migrations/schema to find missing indexes and recommend concrete indexing improvements.
- Configuration Review: Evaluate database.yml settings for connection pooling, timeouts, prepared statements, and SSL to reduce connection overhead and prevent runaway queries.
- Use Case: Run a full audit when users request "analyze the database", "check for N+1 queries", or "optimize PostgreSQL" in a Rails app.
Quick Start
From the Rails project root, run:
- python3 scripts/analyze_n_plus_one.py
- python3 scripts/analyze_indexes.py
- python3 scripts/analyze_config.py