database-optimization

Query optimization, indexing strategies, and database performance tuning for PostgreSQL and MySQL

Content Preview
---
name: database-optimization
description: Query optimization, indexing strategies, and database performance tuning for PostgreSQL and MySQL
---

# Database Optimization

## EXPLAIN Analysis

Always run `EXPLAIN ANALYZE` before optimizing. Read the output bottom-up.

```sql
-- PostgreSQL
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;

-- MySQL
EXPLAIN ANALYZE SELECT ...;
```

Key metrics to watch:
- **Seq Scan** on large tables = missing index
- **Nested Loop** with high row count = consi
How to Use

Recommended: Install to project (local)

mkdir -p .claude/skills
curl -o .claude/skills/database-optimization.md \
  https://raw.githubusercontent.com/rohitg00/awesome-claude-code-toolkit/main/skills/database-optimization/SKILL.md

Skill is scoped to this project only. Add .claude/skills/ to your .gitignoreif you don't want to commit it.

Alternative: Clone full repo

git clone https://github.com/rohitg00/awesome-claude-code-toolkit

Then reference at skills/database-optimization/SKILL.md

Related Skills