database-optimizer

Diagnose and optimize slow queries, indexes, and configurations for PostgreSQL and MySQL databases.

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/filippolmt/skills --skill database-optimizer-filippolmt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/filippolmt/skills/tree/main/skills/database-optimizer
Command: npx skills add https://github.com/filippolmt/skills --skill database-optimizer-filippolmt

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 finding the root cause requires deep expertise in execution plans, statistics, and engine-specific tuning. This Skill provides a structured, measurement-driven workflow to identify bottlenecks and apply validated optimizations. ## Core Features & Use Cases - Query Analysis: Capture and interpret EXPLAIN ANALYZE output, identify sequential scans, stale statistics, and low buffer cache hit rates in PostgreSQL and MySQL. - Index Design: Create covering, partial, expression, GIN, and full-text indexes, and detect redundant or unused indexes. - Configuration Tuning: Tune memory, WAL, autovacuum, InnoDB buffer pool, and connection settings with production-ready configuration examples. - Use Case: A PostgreSQL orders endpoint takes 4 seconds. Use this Skill to capture the baseline execution plan, discover a sequential scan on a large table, add a concurrent covering index, and validate the improvement with before/after metrics. ## Quick Start Analyze this slow PostgreSQL query, explain the execution plan bottlenecks, and propose an index and configuration fix 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 total_exec_time or mean_exec_time to find the slowest queries. Then run EXPLAIN (ANALYZE, BUFFERS) on each candidate to capture the actual execution plan and buffer usage as a baseline.

How do I read a PostgreSQL EXPLAIN ANALYZE execution plan?

Look for sequential scans on large tables, nested loops with large outer sets, row estimate mismatches indicating stale statistics, and low buffer hit ratios. Each pattern maps to a remedy such as adding a B-tree index, running ANALYZE, or increasing shared_buffers.

What is a covering index and when should I use one?

A covering index includes all columns a query needs so the database answers it from the index alone without a heap fetch. In PostgreSQL use the INCLUDE clause; in MySQL append the columns to the index. Use it for frequent queries filtering and projecting a stable column set.

Does this work for both PostgreSQL and MySQL?

Yes, the Skill covers both engines with dedicated references for PostgreSQL tuning and MySQL tuning. It includes engine-specific monitoring queries, configuration examples, and index strategies for each platform.

Why did my new index slow down writes?

Every index adds write amplification because inserts and updates must maintain it. Create indexes with CONCURRENTLY in PostgreSQL to avoid table locks, apply one change at a time, and roll back if write performance or replication lag degrades.

When should I use table partitioning instead of indexes?

Use range or list partitioning when tables grow very large and queries consistently filter on the partition key, such as created_at. Partition pruning then limits scans to relevant partitions, and dropping old partitions becomes a fast metadata operation.