database-optimization

Optimize slow SQL queries and resolve N+1 problems in relational databases.

4|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/89jobrien/steve --skill database-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimization
Source: https://github.com/89jobrien/steve/tree/main/steve/skills/database-optimization
Command: npx skills add https://github.com/89jobrien/steve --skill database-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill optimizes database performance through query optimization, indexing strategies, N+1 resolution, caching, and monitoring.

Core Features & Use Cases

  • Query optimization with EXPLAIN ANALYZE
  • Index design and covering/partial indexes
  • N+1 problem resolution
  • Caching strategies (Redis, Memcached)
  • Migration optimization and performance monitoring

Quick Start

Identify a slow query and generate an optimized version, including an index plan.

Frequently Asked Questions about database-optimization

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

FAQPage Schema
How do I optimize slow SQL queries in PostgreSQL and MySQL?

SQL query optimization involves analyzing execution plans with EXPLAIN ANALYZE, identifying bottlenecks, and rewriting queries for efficiency. This Skill generates optimized query versions and recommends index strategies tailored to your database engine and schema.

What is the N+1 problem and how do I fix it?

The N+1 problem occurs when a query executes one initial statement plus N additional queries in a loop, causing performance degradation. This Skill detects N+1 patterns in relational databases and provides refactored queries and batching strategies to eliminate redundant database calls.

When should I use indexing, caching, or query rewriting to improve database performance?

Indexing accelerates lookups on frequently filtered columns; caching (Redis, Memcached) reduces repeated computation; query rewriting eliminates inefficient joins and subqueries. This Skill evaluates your workload and recommends the right combination for your specific bottleneck.

Can I apply database optimization across PostgreSQL, MySQL, and other relational databases?

Yes. Query optimization principles like index design and EXPLAIN ANALYZE work across PostgreSQL, MySQL, and most relational databases, though syntax and execution details vary by engine. This Skill adapts recommendations to your specific database system.

How do I optimize database migrations and monitor ongoing performance?

Migration optimization ensures schema changes and data transfers complete quickly without locking tables; performance monitoring tracks query times and resource usage post-deployment. This Skill covers both migration tuning and sets up monitoring criteria to catch regressions.