
Database Performance Tuning Analyst
Diagnose and optimize database performance systematically
What You Can Do
Use Claude to systematically analyze your database queries, execution plans, and schema to identify performance bottlenecks. The skill generates actionable optimization recommendations with SQL rewrites, index strategies, and configuration tuning. You'll receive detailed before-and-after performance analysis to validate improvements and prioritize work by impact.
Features
identify problematic queries from logs or execution history with root cause diagnosis
understand EXPLAIN PLAN output and suggest structural optimizations
suggest missing or redundant indexes with selectivity and cardinality analysis
generate optimized SQL with better joins, aggregations, and subquery elimination
identify denormalization opportunities, partitioning strategies, and archival plans
recommend pool size, timeout, and recycling parameters based on your workload
establish before/after measurements to track improvement ROI
rank queries by frequency and cost to focus optimization on highest impact items
Example Output
Slow Query Analysis & Optimization
Current Query (450ms):
SELECT o.id, COUNT(i.id) as item_count, u.name
FROM orders o
JOIN items i ON o.id = i.order_id
JOIN users u ON o.user_id = u.id
WHERE o.created_at > NOW() - INTERVAL '30 days'
GROUP BY o.id, u.name;
EXPLAIN PLAN Issues:
- Seq Scan on orders (5K rows)
- Nested loop joins (no index acceleration)
- Execution: 450ms, 2.8M rows examined
Optimized Query (15ms):
SELECT o.id, COUNT(i.id), u.name
FROM orders o
INNER JOIN items i ON o.id = i.order_id
INNER JOIN users u ON o.user_id = u.id
WHERE o.created_at > NOW() - INTERVAL '30 days'
GROUP BY o.id, u.name;
Index Strategy:
CREATE INDEX idx_orders_created ON orders(created_at)→ 30x faster filteringCREATE INDEX idx_items_order_id ON items(order_id)→ efficient join- Result: 30x improvement (450ms → 15ms)
Schema Redesign Recommendation
Your users table is joined in 14 common queries but only 3 columns are read. Consider:
- Move
bio,profile_picto separateuser_profilestable (read rarely) - Denormalize
tier,countryinto users table (read frequently) - Partition orders by month (queries filter by date)
- Expected 3-4x faster user queries, 50% less cache pressure
What's Included
- `SKILL.md`: Step-by-step database performance analysis and optimization workflow
- Query analysis checklist: systematic process for identifying and prioritizing bottlenecks
- Index optimization framework: methodology for evaluating index effectiveness and ROI
- Query rewrite patterns: SQL optimization templates with before/after examples
- Schema audit checklist: denormalization, partitioning, and archival evaluation guide
- Performance baseline worksheet: measurement template for validating improvements
Who It's For
- Database Administrators optimizing production systems under load
- Backend Engineers debugging slow queries in their services
- DevOps Engineers tuning database infrastructure and connection pools
- Performance Engineers tasked with database scaling initiatives
- Tech Leads evaluating schema redesigns and optimization ROI
Best For
- Analyzing slow query logs and identifying optimization priorities
- Interpreting EXPLAIN PLAN output for complex joins and aggregations
- Designing indexes and estimating expected performance impact
- Refactoring slow SQL queries into optimized versions
- Planning schema changes (denormalization, partitioning, archival strategies)






