Sql Query Optimization
Helps with querying, optimization as part of working with databases and data persistence workflows.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add sql-query-optimization npx -- -y @trustedskills/sql-query-optimization
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"sql-query-optimization": {
"command": "npx",
"args": [
"-y",
"@trustedskills/sql-query-optimization"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill enables AI agents to analyze SQL queries for performance bottlenecks and generate optimized versions that reduce execution time. It specifically targets inefficient patterns like missing indexes, suboptimal joins, and unnecessary data retrieval.
When to use it
- Slow reports: When dashboard loads exceed acceptable thresholds due to complex database queries.
- High-volume transactions: Before deploying batch jobs or ETL processes on large datasets.
- Cost reduction: To minimize cloud database compute costs by reducing query runtime.
- Legacy modernization: Refactoring old, unoptimized SQL codebases for better maintainability.
Key capabilities
- Identifies missing indexes that cause full table scans
- Suggests optimal join strategies and orderings
- Detects redundant columns in SELECT statements
- Flags inefficient subqueries that can be rewritten as joins
- Recommends appropriate index creation or removal
Example prompts
"Analyze this SQL query for performance issues: [paste query]" "Optimize this slow reporting query for a 10 million row table" "Suggest index improvements for this frequently used join operation"
Tips & gotchas
Ensure you provide the full query context and relevant schema details (table sizes, existing indexes) for accurate recommendations. Some optimizations may require database-specific syntax adjustments depending on your SQL dialect.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.