db-optimizer

Optimize database schemas, queries, and indexing for PostgreSQL, MySQL, Supabase, and PlanetScale.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses database performance bottlenecks by optimizing schema design, query execution, and indexing strategies, ensuring applications run efficiently and scale gracefully.

Core Features & Use Cases

  • Schema Design: Creates scalable and maintainable database schemas.
  • Query Optimization: Analyzes and rewrites slow queries using EXPLAIN ANALYZE.
  • Indexing Strategies: Implements effective indexing for improved read performance.
  • N+1 Problem Resolution: Identifies and fixes inefficient data fetching patterns.
  • Safe Migrations: Guides users through creating reversible and non-locking database migrations.
  • Connection Pooling: Advises on efficient connection management.

Quick Start

Use the db-optimizer skill to analyze and optimize the provided SQL query for performance.

Frequently Asked Questions about db-optimizer

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

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

Optimize slow PostgreSQL queries by running EXPLAIN ANALYZE to inspect execution plans, identifying bottlenecks like sequential scans, and rewriting inefficient SQL or adding targeted indexes to improve query performance.

What is the best way to fix the N+1 query problem in database schema design?

Fix the N+1 query problem by identifying inefficient data fetching patterns in your schema design and rewriting them to batch related data retrieval, drastically reducing redundant database round trips and improving application scalability.

Does this database optimization skill work with Supabase and PlanetScale?

Yes, this database optimization skill works with Supabase and PlanetScale, alongside PostgreSQL and MySQL, providing tailored query optimization, safe migration practices, and indexing strategies specific to each platform's architecture.

How do I create non-locking database migrations for high-traffic applications?

Create non-locking database migrations by following safe migration practices that ensure reversibility and avoid locking tables, allowing high-traffic applications to maintain efficient database operations during schema updates.

When should I use connection pooling to improve database performance?

Use connection pooling to improve database performance when your application experiences high concurrent traffic, ensuring efficient connection management and preventing connection exhaustion during heavy database operations.

Why are my database indexes not improving read performance?

Indexes may not improve read performance if they are poorly aligned with query patterns; implementing effective indexing strategies requires analyzing EXPLAIN ANALYZE output to ensure indexes match your most frequent and slowest query filters.