sql-pro

Optimize SQL queries and database schemas for PostgreSQL, MySQL, SQL Server, and Oracle.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/Estom/aiflex --skill sql-pro-estom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-pro
Source: https://github.com/Estom/aiflex/tree/main/skills-repo/Jeffallan-skills/sql-pro
Command: npx skills add https://github.com/Estom/aiflex --skill sql-pro-estom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses slow, inefficient, or poorly structured SQL by providing systematic query optimization, schema and index design, and performance tuning to meet strict latency and scalability goals.

Core Features & Use Cases

  • Query optimization: Rewrite and optimize complex queries using CTEs, window functions, and set-based patterns to eliminate row-by-row processing.
  • Execution plan analysis: Interpret EXPLAIN/ANALYZE output, identify cardinality estimation issues, and recommend targeted index or statistic updates.
  • Schema & indexing design: Advise normalization vs. denormalization, primary/foreign key strategies, covering/partial/index maintenance, and partitioning for large tables.
  • Use Cases: Tune slow OLTP queries, design analytical queries for data warehouses, migrate and adapt queries across PostgreSQL, MySQL, SQL Server, and Oracle.

Quick Start

Analyze this slow PostgreSQL query and return an optimized SQL version, required index DDL with rationale, an execution plan summary, and expected before/after performance notes.

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 execution plan analysis?

Optimize slow SQL queries by interpreting EXPLAIN/ANALYZE output to identify cardinality estimation issues, then rewriting complex logic using CTEs and window functions to eliminate row-by-row processing.

What is the best way to design covering and partial indexes for PostgreSQL?

Design covering and partial indexes for PostgreSQL by analyzing workload requirements to target specific query patterns, reducing index maintenance overhead while ensuring indexes contain all columns needed to satisfy the query.

Does this SQL performance tuning approach work with both MySQL and Oracle?

Yes, SQL performance tuning applies to PostgreSQL, MySQL, SQL Server, and Oracle, allowing you to migrate and adapt queries across these platforms while tuning OLTP queries and designing analytical queries for data warehouses.

Why does PostgreSQL choose a sequential scan instead of using my indexes?

PostgreSQL chooses a sequential scan over indexes when statistics are outdated or cardinality estimation is poor, requiring statistic updates or targeted index adjustments like covering or partial indexes to improve the execution plan.

When should I use table partitioning instead of adding more indexes?

Use table partitioning instead of adding indexes when managing large tables where index maintenance overhead becomes prohibitive, leveraging partitioning to improve scalability for both OLTP and OLAP workloads.