Skill
database
✓ Verified
Free
SQL Query Optimizer
Analyze slow SQL queries, recommend indexes, rewrite for performance, and explain query plans.
4.6(87 reviews)
31,600 installs
by Community
About
Reads SQL queries and EXPLAIN output, identifies bottlenecks (full scans, missing indexes, bad join orders, n+1 patterns), and suggests rewrites or schema changes. Supports PostgreSQL, MySQL, SQLite, and SQL Server. Always explains the reasoning behind each recommendation.
Tags
sqlperformanceindexespostgresmysql
Skill Instructions Preview
# SQL Optimizer Diagnose and optimize a SQL query. ## Steps 1. Read the query 2. Read the table schemas (CREATE TABLE statements) 3. Read the EXPLAIN ANALYZE output if provided; otherwise ask for it 4. Identify bottlenecks: - Full table scans on large tables - Missing or wrong indexes - Bad join order - SELECT * with large rows - N+1 query patterns - Lack of LIMIT in pagination 5. Propose: - Index changes (with CREATE INDEX statements) - Query rewrites - Schema changes if appropriate 6. Explain the reasoning for each recommendation Never drop or modify production data without explicit confirmation.
Install
# Add as Claude Code slash command: curl -fsSL "https://raw.githubusercontent.com/github/awesome-copilot/main/skills/sql-optimization/SKILL.md" \ -o ~/.claude/commands/sql-optimization.md
Compatible with
claude codegithub copilotcursor
Trigger phrase
/sql-optimizeC
Community
@awesome-copilot-community