Agent skill · Databases

database-optimization

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

Rohit Ghumare73,165★ · +3,601/wk · 3 repos on radarProfile →
claude-codeApache-2.0
Install
npx skills add rohitg00/awesome-claude-code-toolkit --skill database-optimization --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 5 KB
Bundled scripts: none
Path: skills/database-optimization/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 2,438
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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 = consider hash/merge join - **Sort** without index = add index on sort column - **Rows estimated vs actual** divergence = stale statistics, run `ANALYZE` ## Index Strategies ### B-tree (default, most cases) ```sql CREATE INDEX idx_users_email ON users (email); CREATE INDEX idx_orders_user_date ON orders (user_id, created_at DESC); ``` Use for: equality, range queries, sorting. Column order matters in composite indexes: put equality columns first, then range/sort columns. ### Partial Index (PostgreSQL) ```sql CREATE INDEX idx_orders_pending ON orders (created_at) WHERE status = 'pending'; ``` Use when queries always filter on a specific condition. Dramatically smaller than full indexes. ### GIN (PostgreSQL - arrays, JSONB, full-text) ```sql CREATE INDEX idx_products_tags ON products USING GIN (tags); CREATE INDEX idx_docs_search ON documents USING

What's inside
Steps it walks through
  1. EXPLAIN Analysis
  2. Index Strategies
  3. B-tree (default, most cases)
  4. Partial Index (PostgreSQL)
  5. GIN (PostgreSQL - arrays, JSONB, full-text)
  6. GiST (PostgreSQL - spatial, range types)
  7. Covering Index (index-only scans)
  8. N+1 Query Detection
  9. Connection Pooling
  10. Read Replicas
  11. Partition Strategies
  12. Range Partitioning (time-series data)
  13. Hash Partitioning (even distribution)
  14. Query Optimization Checklist
More from awesome-claude-code-toolkit
All skills →
About this skill
What does the database-optimization skill do?

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

How do I install it?

Run `npx skills add rohitg00/awesome-claude-code-toolkit --skill database-optimization --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rohitg00/awesome-claude-code-toolkit, a repository with 2,438 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going