query-optimization
SQL query optimization and performance tuning
When & Why to Use This Skill
This Claude skill provides comprehensive SQL query optimization and performance tuning capabilities. It empowers developers and database administrators to identify bottlenecks through EXPLAIN plan analysis, implement advanced indexing strategies, and refactor complex query patterns to maximize database efficiency and reduce latency across various systems like PostgreSQL, MySQL, and SQL Server.
Use Cases
- Analyzing execution plans and cost-based optimization statistics to identify and resolve performance bottlenecks in slow-running production queries.
- Designing and implementing optimal indexing strategies, including covering, partial, and B-tree indexes, to significantly speed up data retrieval processes.
- Refactoring inefficient SQL patterns, such as nested subqueries or poorly structured JOINs, into high-performance alternatives like window functions or optimized pagination patterns.
- Providing database-specific tuning advice and hints for cloud-based or on-premise environments to handle high-concurrency workloads and bulk data operations.
| name | query-optimization |
|---|---|
| description | SQL query optimization and performance tuning |
| sasmp_version | "1.3.0" |
| bonded_agent | 01-sql-fundamentals |
| bond_type | PRIMARY_BOND |
Query Optimization Skill
Overview
Optimize SQL queries for maximum performance across different database systems.
Topics Covered
Query Analysis
- EXPLAIN plans
- Execution statistics
- Cost-based optimization
- Query profiling
- Wait event analysis
Indexing Strategy
- B-tree indexes
- Covering indexes
- Partial indexes
- Index selection
- Index maintenance
Query Patterns
- JOIN optimization
- Subquery alternatives
- Aggregate optimization
- Pagination patterns
- Bulk operations
Database Specific
- PostgreSQL optimization
- MySQL tuning
- SQL Server hints
- Oracle optimization
- Cloud DB optimization
Prerequisites
- SQL fundamentals
- Database internals basics
Learning Outcomes
- Analyze query plans
- Create effective indexes
- Rewrite slow queries
- Tune database performance