database-optimizer

Diagnose and optimize database queries, indexes, caching, and scaling architectures.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill database-optimizer-5onyy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/5onyy/essential-ai-agent-skills/tree/main/.cursor/skills/database-optimizer
Command: npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill database-optimizer-5onyy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Slow queries, missing indexes, N+1 patterns, and poorly scaled databases degrade application performance and inflate infrastructure costs, and diagnosing them requires deep expertise across many database platforms. ## Core Features & Use Cases - Query and Index Optimization: Analyze execution plans, rewrite complex queries, and design composite, partial, and specialized indexes for PostgreSQL, MySQL, SQL Server, and NoSQL systems. - Caching and Scaling Architectures: Design multi-tier caching with Redis, implement read replicas, sharding, and partitioning strategies for horizontal growth. - Use Case: A GraphQL API suffers from N+1 queries under load. Use this Skill to detect the query patterns, apply DataLoader batching, add covering indexes, and validate the improvement with pgbench benchmarks. ## Quick Start Ask the agent to analyze a slow query's execution plan and recommend indexing and caching optimizations for your PostgreSQL database.

Frequently Asked Questions about database-optimizer

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

FAQPage Schema
How do I optimize a slow SQL query with multiple JOINs?▼

Start by running EXPLAIN ANALYZE to inspect the execution plan and identify costly operations like sequential scans or nested loops. Then rewrite the query, add composite or covering indexes matching the JOIN and filter columns, and validate improvements with benchmarking tools like pgbench.

How to fix N+1 queries in an ORM or GraphQL API?▼

Detect N+1 patterns through ORM query logging or application profiling, then resolve them with eager loading, batch queries, or JOIN optimization. For GraphQL, apply DataLoader patterns with query batching and field-level caching.

Does this optimization guidance work with cloud databases like RDS and Aurora?▼

Yes, it covers cloud-specific tuning including RDS Performance Insights, Aurora indexing and serverless patterns, Azure SQL intelligent performance, and DynamoDB GSI optimization. It also addresses cloud cost optimization through reserved capacity and storage tiering.

What indexing strategy should I use for a high-traffic application?▼

Design indexes based on actual query patterns rather than indexing every column. Use composite indexes with correct column ordering, partial indexes for filtered queries, and specialized types like GIN for JSONB or full-text search, while managing index bloat over time.

When should I denormalize a database schema?▼

Denormalize when read patterns justify it and benchmarking shows normalization causes expensive JOINs on hot paths. Balance the performance gain against increased write complexity and storage cost, and document the rationale with measured impact.