What problem does it solve?
This skill provides a structured, repeatable approach to identifying and fixing database performance issues across PostgreSQL, Prisma, and Supabase. It guides you through validating the current state, applying targeted index improvements, and tuning queries to reduce latency and resource usage.
Core Features & Use Cases
- CRITICAL: Check Existing First: Verify current indexes, migrations, and advisor hints before making changes.
- Performance Investigation: Identify slow queries and analyze their execution plans to determine bottlenecks.
- N+1 Query Fix: Replace iterative fetches with eager loading to minimize database round-trips.
- Index Optimization: Recommend and implement single, composite, partial, and specialized indexes to accelerate filters and joins.
- Query Analysis & Best Practices: Provide patterns for selecting fields, paginating results, and batching operations.
- Schema Design Guidance: Balance normalization and denormalization to optimize read/write performance.
- Supabase-Specific Tips: Optimize RLS and edge-function use for scalable data access.
- Operational Checklist: Ensure monitoring, explain analyze, and safe deployment practices.
Quick Start
Begin by profiling slow queries, running explain analyze, and iteratively applying targeted indexes and query optimizations until performance meets the desired targets.