Explain Query
Use when
- User asks why query is slow.
- Planner needs operator-level bottleneck explanation.
Workflow
- Parse query intent and classify risk (read-only preferred mode).
- Collect
EXPLAINandEXPLAIN ANALYZEoutput in deterministic form. - Annotate scan patterns, joins, sort/hash/temp spills, and lock indicators.
- Produce rewrite hypotheses with confidence scores.
Governance
- Default to dry-run style if query could mutate data.
- Provide "why" and "impact estimate" before any recommendation.
Output
plan,bottlenecks,rewriteHints,estimatedCost,confidence