Back to skills
SKILL.md
Query Optimization
ASecurityFind and fix slow queries with EXPLAIN ANALYZE, indexes, and query rewrites.
- 2 stars
- 0 votes
- 0 copies
- 0 views
- Added December 2, 2026
Security analysis
100/100npx -y skills add karthikrshet/saarthi --skill query-optimization --agent claude-codeAre you the author of Query Optimization?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/karthikrshet-query-optimization)---
name: query-optimization
description: Find and fix slow queries with EXPLAIN ANALYZE, indexes, and query rewrites.
tags: [database, performance]
---
# Query Optimization
## When to use
- Slow endpoints, high DB CPU
## Procedure
1. Find top queries (pg_stat_statements, slow log)
2. EXPLAIN ANALYZE
3. Add or adjust indexes
4. Rewrite to avoid N+1 and SELECT *
5. Re-measure
## Checklist
- [ ] Before/after timings recorded
## Anti-patterns
- Adding indexes blindly
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.