database-optimizer

Analyze PostgreSQL and MySQL execution plans to optimize slow queries.

14|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/alexander-danilenko/ai-skills --skill database-optimizer-alexander-danilenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/alexander-danilenko/ai-skills/tree/main/skills/database-optimizer
Command: npx skills add https://github.com/alexander-danilenko/ai-skills --skill database-optimizer-alexander-danilenko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Many databases suffer from slow queries, poor index design, and misconfigured settings that increase latency, IO, and resource usage; this Skill helps identify root causes and deliver targeted optimizations to restore performance and scalability.

Core Features & Use Cases

  • Execution plan analysis: Interpret EXPLAIN/EXPLAIN ANALYZE output to find cardinality errors, expensive scans, and join inefficiencies.
  • Indexing & query rewrites: Recommend single-column, multi-column, partial, and expression indexes plus query rewrites or window function optimizations.
  • Configuration & partitioning guidance: Suggest PostgreSQL and MySQL tuning parameters, partition strategies, and maintenance steps with validation queries.
  • Use Case: Take a slow reporting query on PostgreSQL, analyze pg_stat_statements and EXPLAIN ANALYZE, propose index and query changes, and provide validation steps to confirm improvements.

Quick Start

Ask the database-optimizer to analyze this slow query and its EXPLAIN ANALYZE output, list the bottlenecks, and provide specific SQL index or rewrite suggestions plus validation queries.

Frequently Asked Questions about database-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze a slow query execution plan in PostgreSQL or MySQL?

To analyze a slow query execution plan, you interpret EXPLAIN or EXPLAIN ANALYZE output to identify cardinality errors, expensive sequential scans, and join inefficiencies. This process pinpoints the root causes of high latency and IO consumption in your database operations.

What is the best way to fix slow database queries and reduce resource consumption?

Fixing slow database queries involves recommending targeted index designs like single-column or partial indexes, rewriting inefficient SQL, and tuning configuration parameters. These optimizations restore database performance and scalability while reducing overall resource usage.

Does this database optimization approach work for both PostgreSQL and MySQL staging environments?

Yes, this database optimization approach applies to both PostgreSQL and MySQL systems in production and staging scenarios. It provides specific tuning parameters, partition strategies, and lock contention resolution tailored for each platform's architecture.

How do I resolve lock contention and design indexes for complex reporting queries?

Resolving lock contention and designing indexes for reporting queries requires analyzing execution plans and recommending multi-column or expression indexes. You also apply query rewrites using window functions to optimize performance and validate improvements.

What steps do I take to validate database configuration tuning and partitioning changes?

To validate database configuration tuning and partitioning changes, you execute provided validation queries and monitor performance metrics. This confirms that the recommended tuning parameters and maintenance steps effectively reduced query latency.

When should I use partition strategies instead of adding indexes for database optimization?

You should use partition strategies instead of adding indexes when dealing with large tables where maintenance and query scans become bottlenecks. Partitioning splits data physically to reduce IO, whereas indexes optimize specific lookup paths.