SQL Explain

Analyzes PostgreSQL and SQLAlchemy/Oracle query execution plans to identify bottlenecks and recommend indexes.

1|1|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/btabaska/simpler-grants-documentation-automation --skill sql-explain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: SQL Explain
Source: https://github.com/btabaska/simpler-grants-documentation-automation/tree/main/.cursor/skills/skill-sql-explain
Command: npx skills add https://github.com/btabaska/simpler-grants-documentation-automation --skill sql-explain

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Quickly understand why a SQL or SQLAlchemy query runs slowly by generating a clear execution plan explanation and highlighting bottlenecks such as slow joins, sequential scans, and missing indexes.

Core Features & Use Cases

  • Explain a query's execution plan for PostgreSQL, including cost estimates and key plan nodes.
  • Identify common performance patterns like nested loops, large seq scans, and lack of useful indexes.
  • Provide actionable optimization recommendations, including index suggestions and ORM query improvements applicable to code under api/src/db/ and api/src/services/.

Quick Start

Paste the target SQL text or select it in your editor and request an explanation of its execution plan and recommended optimizations.

Frequently Asked Questions about SQL Explain

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

FAQPage Schema
How do I analyze a PostgreSQL execution plan to find slow queries?

To identify missing indexes, review the execution plan for large sequential scans and high cost estimates on specific tables. The analysis isolates these hot spots and provides targeted index recommendations to eliminate sequential scanning bottlenecks.

Can I optimize ORM-generated queries in SQLAlchemy?

You can optimize ORM-generated queries by examining the underlying SQL execution plan to spot inefficient patterns. The analysis pinpoints performance issues like unnecessary nested loops and suggests specific ORM query improvements for code in api/src/db/ or api/src/services/.

What is the best way to find bottlenecks in a SQL query plan?

Finding bottlenecks in a SQL query plan requires static analysis of cost estimates and key plan nodes. This approach exposes heavy operations such as slow joins and sequential scans, delivering actionable optimization recommendations without modifying your data.

Does the SQL execution plan analysis work without modifying my database data?

Yes, SQL execution plan analysis works without modifying your database data. It performs static analysis and optional live explains to report cost estimates, hot spots, and index recommendations, strictly reading query plans to ensure read-only safety.