database-optimizer

Diagnose slow SQL queries and optimize PostgreSQL and SQLite configurations.

Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Astrumon/Spovishun --skill database-optimizer-astrumon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/Astrumon/Spovishun/tree/main/.claude/skills/database-optimizer
Command: npx skills add https://github.com/Astrumon/Spovishun --skill database-optimizer-astrumon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams find and remediate database performance bottlenecks by guiding a methodical workflow for capturing baselines, analyzing execution plans, designing indexes, and validating changes to reduce query latency and I/O impact.

Core Features & Use Cases

  • Baseline and analysis: Capture EXPLAIN ANALYZE outputs and key metrics to identify the slowest queries and the root causes.
  • Index and schema design: Recommend single-column, composite, partial, and covering indexes plus CREATE INDEX CONCURRENTLY patterns to avoid locks.
  • N+1 detection and query rewrites: Identify ORM-driven N+1 patterns and provide JOIN-based rewrites or batch strategies to eliminate them.
  • Use Case: For a Telegram bot that frequently joins members, group_members, and groups tables, use this Skill to produce an execution plan, propose a covering index and a single-query rewrite, and validate the before/after timing delta.

Quick Start

Run an EXPLAIN ANALYZE on the slow query and provide the execution plan plus schema/index metadata to receive prioritized index and rewrite recommendations.

Frequently Asked Questions about database-optimizer

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

FAQPage Schema
How do I diagnose slow PostgreSQL queries using EXPLAIN ANALYZE?

To diagnose slow PostgreSQL queries, run EXPLAIN ANALYZE to capture execution plans and baseline metrics. Provide the output alongside schema and index metadata to identify root causes of high latency and excessive IO.

What's the best way to fix ORM N+1 query patterns?

To fix ORM N+1 query patterns, identify the redundant queries and apply JOIN-based rewrites or batch strategies. This Skill detects N+1 issues from execution plans and provides query rewrites to eliminate them.

How do I design indexes to reduce query latency without locking tables?

Design indexes to reduce query latency by applying single-column, composite, partial, and covering indexes. This Skill recommends CREATE INDEX CONCURRENTLY patterns for PostgreSQL to avoid locks during index creation.

Can I use this query optimization workflow for SQLite environments?

Yes, you can use this query optimization workflow for SQLite environments. The Skill applies to both PostgreSQL and SQLite for execution plan analysis, index design, and query rewrites to reduce latency and I/O impact.

What metadata do I need to provide for database performance tuning?

For database performance tuning, you need to provide EXPLAIN ANALYZE output, schema and index metadata, and representative workload metrics. This data is required to produce prioritized, validated optimization recommendations.