database-optimizer

Analyzes execution plans and optimizes query performance for PostgreSQL and MySQL databases.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/ArMaTeC/Redball --skill database-optimizer-armatec
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/ArMaTeC/Redball/tree/main/.devin/skills/database-optimizer
Command: npx skills add https://github.com/ArMaTeC/Redball --skill database-optimizer-armatec

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Slow database queries, missing indexes, and misconfigured servers degrade application performance, and diagnosing root causes requires deep expertise in execution plans, statistics, and engine-specific tuning. ## Core Features & Use Cases - Query Analysis: Capture and interpret EXPLAIN ANALYZE output to find sequential scans, stale statistics, and inefficient join strategies. - Index Design: Create B-tree, covering, partial, expression, GIN, and full-text indexes matched to actual query patterns. - Configuration Tuning: Optimize memory, WAL, autovacuum, buffer pool, and connection settings for PostgreSQL and MySQL. - Use Case: A reporting query takes 30 seconds. Use this Skill to capture the baseline plan, identify a missing covering index, create it with CONCURRENTLY, and validate the improvement with before/after metrics. ## Quick Start Analyze this slow PostgreSQL query, explain the execution plan bottlenecks, and recommend indexes and configuration changes with 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 find slow queries in PostgreSQL?▼

Enable the pg_stat_statements extension and query it ordered by mean_exec_time or total_exec_time to find the slowest queries. Then run EXPLAIN (ANALYZE, BUFFERS) on each candidate to capture the actual execution plan and buffer usage.

How to create an index without locking a PostgreSQL table?▼

Use CREATE INDEX CONCURRENTLY, which builds the index without blocking reads and writes on the table. It takes longer than a standard build but is safe for production systems with active traffic.

What is the difference between PostgreSQL and MySQL tuning?▼

PostgreSQL tuning centers on shared_buffers, work_mem, autovacuum, and WAL settings, while MySQL tuning focuses on the InnoDB buffer pool, log file size, and flush behavior. Both rely on execution plan analysis but use different diagnostic tools and syntax.

Why does my query ignore an existing index?▼

Common causes include stale table statistics, functions wrapping the indexed column, low selectivity making a sequential scan cheaper, or implicit type conversion. Run ANALYZE on the table and check the EXPLAIN output for row estimate mismatches.

When should I use a covering index?▼

Use a covering index when a query repeatedly filters on some columns and returns a small set of others, allowing an index-only scan. In PostgreSQL add non-key columns with INCLUDE; in MySQL append them to the index definition.

What are the risks of adding too many indexes?▼

Every index slows down INSERT, UPDATE, and DELETE operations and consumes storage. Redundant indexes like (a) plus (a,b) waste resources, so monitor pg_stat_user_indexes or performance_schema and drop indexes with zero scans.