What problem does it solve?
This Skill tackles the critical issue of slow database performance by automatically identifying and fixing inefficient SQL and NoSQL queries. It helps developers and data professionals improve application responsiveness, reduce database load, and prevent costly performance bottlenecks.
Core Features & Use Cases
- Multi-Database Support: Analyzes and optimizes queries for a wide range of databases, including PostgreSQL, MySQL, SQLite, MongoDB, Redis, DynamoDB, and Elasticsearch.
- Anti-Pattern Detection: Automatically flags common performance killers such as
SELECT *, N+1 query patterns, large OFFSET values, functions in WHERE clauses, and COLLSCAN in MongoDB.
- Actionable Recommendations: Provides concrete, copy-pasteable code solutions for creating optimal indexes, rewriting inefficient queries, and implementing ORM eager loading strategies.
- EXPLAIN Output Analysis: Interprets database execution plans (e.g.,
EXPLAIN ANALYZE) to pinpoint exact bottlenecks, identify scan types, and verify the impact of optimizations.
- Codebase Audit: Detects ORM anti-patterns directly in application code and analyzes schema for optimization opportunities like missing foreign key indexes.
- Use Case: A developer notices a dashboard loading slowly. They provide the SQL query to this skill, which identifies a missing index and an N+1 pattern, then suggests the exact
CREATE INDEX statement and an ORM prefetch_related fix, along with EXPLAIN commands to verify the improvement.
Quick Start
Optimize the following SQL query: "SELECT * FROM users WHERE email LIKE '%@example.com' ORDER BY created_at DESC OFFSET 1000 LIMIT 50;"