query-plan-reader

Read SQL execution plans and rank tuning fixes with evidence.

2|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill query-plan-reader
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-plan-reader
Source: https://github.com/nguyenpv1980-wq/Project-Aegis/tree/main/.claude/skills/query-plan-reader
Command: npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill query-plan-reader

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you diagnose why a single SQL query is slow by reading its execution plan, identifying the dominant cost node, and separating real bottlenecks from misleading assumptions.

Core Features & Use Cases

  • Plan interpretation: Explains scans, joins, sorts, spills, and row-estimate mismatches in plain language.
  • Evidence-based tuning: Ranks fixes such as statistics refresh, query rewrite, index changes, or schema adjustments by cost and likely impact.
  • Multi-tenant awareness: Accounts for tenant predicates and row-security filters that affect the plan and index choice.
  • Use cases: Interpreting EXPLAIN ANALYZE output, deciding whether an index is justified, and verifying that a fix changes the plan as expected.

Quick Start

Use the query-plan-reader skill to analyze this query’s execution plan, identify the dominant cost, and recommend the cheapest fix with a re-verification method.

Frequently Asked Questions about query-plan-reader

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

FAQPage Schema
How do I interpret an EXPLAIN ANALYZE execution plan to find slow query bottlenecks?

Execution plan analysis reads operator costs, row estimate mismatches, and spills to identify the dominant bottleneck. It translates scan, join, and sort nodes into plain language, separating real performance issues from misleading assumptions.

What is the best way to rank SQL query tuning fixes by cost and impact?

Query tuning ranks fixes like statistics refresh, query rewrite, index changes, and schema adjustments by their estimated cost reduction and likely performance impact. This evidence-based approach prioritizes the cheapest effective solution.

How do I read query execution plans for multi-tenant databases with row-level security?

Multi-tenant plan reading accounts for tenant predicates and row-security filters that influence index choices and operator costs. It evaluates whether the execution plan properly utilizes tenant-aware indexes under representative data volumes.

Why does my query execution plan show a mismatch between estimated and actual rows?

Estimate-versus-actual divergence occurs when optimizer statistics are outdated or parameter values skew row expectations. Analyzing this mismatch reveals whether the chosen scan or join operator is inefficient for the actual data scale.

How do I verify that an index change fixes a slow SQL query?

Re-verification runs the query execution plan at the same parameter values and data scale after applying the fix. This confirms whether the new index or query rewrite actually changed the operator behavior and reduced cost.

When do I need statistics refresh versus an index change for query tuning?

Statistics refresh is needed when estimate-versus-actual rows diverge significantly without missing indexes. Index changes are justified when the execution plan shows expensive sequential scans or inefficient joins that a targeted index could eliminate.