Database Optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
Before & after
Same prompt, same agent — the only difference is the skill.
That's a slow query. There are several things that could be causing that. You might be missing an index, or the query itself might not be written efficiently. I'd want to see the execution plan to understand where the time is being spent. Does the query have a lot of joins? Are you using any complex functions? It's hard to say without more details. If you can share the query and table structures, I can look at what might be slowing it down. Have you tried analyzing the execution plan already?
SLOW QUERY ANALYSIS Original Query: 45.2s execution time EXECUTION PLAN BREAKDOWN Full table scan on orders (50M rows): 38.4s ← BOTTLENECK Hash join on customers: 4.1s Sort and filter: 2.7s ROOT CAUSE No index on orders(status, created_at) Query filtering on status='active' AND created_at > date Database must scan all 50M rows OPTIMIZED QUERY ADD INDEX: CREATE INDEX idx_orders_status_created ON orders(status, created_at); Rewritten query uses index for both status and date filtering: SELECT o.id, c.name, o.amount FROM orders o INNER JOIN customers c ON o.customer_id = c.id WHERE o.status = 'active' AND o.created_at > NOW() - INTERVAL 30 days ORDER BY o.created_at DESC; RESULT: 1.3s execution time (34x improvement) BREAKDOWN Index seek: 0.8s Join: 0.4s Sort: 0.1s PARTITIONING STRATEGY (If index not enough) Partition orders table by month on created_at Prunes 97% of partitions for 30-day queries Combined with index: 200ms execution time MONITOR Add query to slow-query log alerts Recheck index usage monthly
About this skill
name: database-optimizer description: Use when Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
Database Optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
What you get
- Public GitHub repo
- the skills/database-optimizer folder with SKILL.md and references.
Customize your output
- Fork the repo and extend the skill's reference files for your own stack conventions.
Example output
Activates on a matching request (e.g. building or reviewing Database Optimizer code) and can chain with other skills in the pack.
Best for
Full-stack developers and engineering teams using Claude Code.
SKILL.md preview
---
name: database-optimizer
description: Use when investigating slow queries, analyzing execution plans, or tuning PostgreSQL or MySQL database performance.
version: 1.0.0
category: Development / Data & ML
author: AgentVolt
license: proprietary
tags:
- development
- data-ml
---
# Database Optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems, covering index design, query rewrites, configuration tuning, and lock contention.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Pandas Pro
Performs pandas DataFrame operations for data analysis, manipulation, and transformation.
Spark Engineer
Use when writing Spark jobs, debugging performance issues, or configuring cluster settings for Apache Spark applications, distributed data processing pipelines, or big data workloads.
Fine Tuning Expert
Use when fine-tuning LLMs, training custom models, or adapting foundation models for specific tasks.
RAG Architect
Designs and implements production-grade RAG systems by chunking documents, generating embeddings, configuring vector stores, building hybrid search pipelines.