sql-pro

Optimize slow SQL queries and schemas with EXPLAIN plan analysis and index recommendations.

14|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/alexander-danilenko/ai-skills --skill sql-pro-alexander-danilenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-pro
Source: https://github.com/alexander-danilenko/ai-skills/tree/main/skills/sql-pro
Command: npx skills add https://github.com/alexander-danilenko/ai-skills --skill sql-pro-alexander-danilenko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Slow, unscalable, or poorly structured SQL queries and database schemas that cause high latency, excessive resource usage, and unpredictable performance in production systems are diagnosed and resolved with pragmatic, reproducible improvements.

Core Features & Use Cases

  • Execution Plan Analysis and Tuning: Interpret EXPLAIN/ANALYZE output, identify costly operations, and propose rewrites or index changes.
  • Advanced Query Design: Build and optimize complex queries using CTEs, window functions, and set-based patterns to replace row-by-row processing.
  • Indexing & Schema Guidance: Recommend covering, partial, and expression indexes, partitioning strategies, and schema changes for OLTP and OLAP workloads.
  • Use Case: Convert a slow reporting query into an index-backed, CTE-based plan with platform-specific notes for PostgreSQL and MySQL and measurable before/after timings.

Quick Start

Use the sql-pro skill to analyze a slow query's EXPLAIN ANALYZE output and provide optimized SQL, index recommendations, and expected performance improvements.

Frequently Asked Questions about sql-pro

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

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

To optimize slow SQL queries, analyze EXPLAIN ANALYZE output to identify costly operations like sequential scans, then apply query rewrites, CTEs, or index changes to improve execution time and reduce resource usage.

What is the best way to use window functions and CTEs for complex query tuning?

Window functions and CTEs improve complex query tuning by replacing row-by-row processing with set-based patterns, allowing you to build optimized SQL that handles advanced analytical logic efficiently across large datasets.

Does query optimization support cross-dialect migrations for PostgreSQL and MySQL?

Query optimization supports cross-dialect migrations for PostgreSQL, MySQL, SQL Server, and Oracle by providing platform-specific notes, dialect-aware SQL rewrites, and index recommendations tailored to each database engine's execution planner.

When should I use covering, partial, or expression indexes for database schema optimization?

Use covering, partial, and expression indexes for database schema optimization when targeting specific query patterns in OLTP or OLAP workloads, ensuring the index backs the query filters and projections to minimize execution time.

Why does my SQL query performance degrade on production-scale datasets?

SQL query performance degrades on production-scale datasets due to missing indexes, inefficient row-by-row processing, or unoptimized execution plans, which can be resolved by applying partitioning strategies and set-based query rewrites.