database-optimizer

Optimize SQL queries and design indexes for PostgreSQL and MySQL databases.

1|1|Updated Aug 5, 2025
One-click install
npx skills add https://github.com/slantview/claude --skill database-optimizer-slantview
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/slantview/claude/tree/main/skills/database-optimizer
Command: npx skills add https://github.com/slantview/claude --skill database-optimizer-slantview

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses performance bottlenecks in databases by optimizing SQL queries, designing efficient indexes, and managing database migrations.

Core Features & Use Cases

  • Query Optimization: Analyzes and rewrites slow SQL queries for improved execution speed.
  • Index Management: Designs and implements optimal database indexes to speed up data retrieval.
  • Migration Handling: Creates and manages database migration scripts with rollback capabilities.
  • Use Case: Resolve an N+1 query problem in a web application that is causing slow page loads by using this Skill to identify and fix the inefficient database interactions.

Quick Start

Optimize the attached SQL query by analyzing its execution plan and suggesting index improvements.

Frequently Asked Questions about database-optimizer

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?

Optimize slow SQL queries by running EXPLAIN ANALYZE to measure execution performance, identifying bottlenecks in the execution plan, rewriting the query structure, and designing strategic indexes to accelerate data retrieval.

What is an N+1 query problem and how do I resolve it?

The N+1 query problem happens when an application executes individual database queries for each item in a collection. Resolve it by analyzing database interactions, consolidating queries, and implementing strategic indexing or caching strategies.

How do I design efficient database indexes for performance optimization?

Design efficient database indexes by analyzing query execution plans with EXPLAIN ANALYZE to identify slow retrieval operations, then implementing strategic indexing on specific columns used in filtering and joins to accelerate query performance.

Does this database optimization approach support database migrations with rollback?

Yes, this approach handles database migrations by creating and managing migration scripts equipped with rollback capabilities, allowing you to safely apply and revert schema changes in PostgreSQL and MySQL environments.

What is the best way to measure database query performance before and after indexing?

The best way to measure database query performance is to run EXPLAIN ANALYZE before and after optimization, comparing execution times and scan strategies to validate the impact of strategic indexing and query rewrites.

When should I implement caching strategies for database optimization?

Implement caching strategies for database optimization when query rewriting and strategic indexing are insufficient to reduce execution latency, providing a layer to bypass slow database interactions and resolve persistent performance bottlenecks.