sql-optimizer

Analyze SQL query plans and generate index recommendations for PostgreSQL, MySQL, and SQLite.

6|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/NachoOsella/DotFiles-V4 --skill sql-optimizer-nachoosella
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimizer
Source: https://github.com/NachoOsella/DotFiles-V4/tree/main/pi/.pi/agent/skills/sql-optimizer
Command: npx skills add https://github.com/NachoOsella/DotFiles-V4 --skill sql-optimizer-nachoosella

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

SQL performance often suffers from missing or ineffective indexes, slow scans, and poorly designed schemas. This skill provides a guided workflow to analyze, optimize, and validate query plans across common RDBMS.

Core Features & Use Cases

  • Automated plan analysis with EXPLAIN and ANALYZE reviews
  • Index recommendations and schema-design guidance
  • N+1 query elimination and query rewriting optimizations
  • Statistics maintenance and plan validation across PostgreSQL, MySQL, and SQLite

Quick Start

Run the sql-optimizer on a slow query to generate actionable index recommendations and a revised schema design

Frequently Asked Questions about sql-optimizer

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

FAQPage Schema
How do I fix slow SQL queries using EXPLAIN and ANALYZE?

SQL query performance improves by analyzing EXPLAIN and ANALYZE execution plans to identify bottlenecks, then applying index tuning and query rewriting to eliminate slow scans across PostgreSQL, MySQL, and SQLite workloads.

What is the best way to eliminate N+1 query problems in SQL databases?

N+1 query elimination involves rewriting query logic to batch related data retrieval, reducing redundant database round trips and optimizing overall schema design for both OLTP and analytical scenarios.

Does this SQL optimization approach work with PostgreSQL, MySQL, and SQLite?

Yes, this SQL optimization workflow supports PostgreSQL, MySQL, and SQLite workloads, providing automated plan analysis, index recommendations, and statistics maintenance across all three relational database management systems.

How do I generate index recommendations for an existing database schema?

Index recommendations are generated by analyzing slow queries and execution plans, identifying missing or ineffective indexes, and providing schema design improvements to resolve performance bottlenecks.

When should I perform SQL statistics maintenance to improve query performance?

SQL statistics maintenance should be performed when execution plans become inefficient due to stale data distributions, ensuring the query optimizer selects the most effective index strategies and access paths.