Ask with SQL · stop 4 of 5
deep_plan_analysis
Runs a query with timing and explains where the time goes.
Works in read modeTool sets: dba · full
You might ask
“Why is this report query slow?”
Your assistant may call deep_plan_analysis to answer.
How it works
- Runs
EXPLAIN ANALYZEby default, so the query really executes. Passanalyze: falsefor estimates only. - Parses the plan and grades findings by severity: bad row estimates, expensive scans, costly functions, CTEs and subqueries, with suggestions.
Parameters
sqlstringrequired- A single SELECT or WITH statement to analyze.
analyzeboolean- If false, use plan-only estimates without executing the query. Default true.
What your assistant reads
The description nexql-mcp sends with the tool. It's how the assistant decides when to use it.
Run EXPLAIN (ANALYZE by default) and return parsed plan metrics (scan counts, bottlenecks, buffer stats) plus severity-graded findings: estimate skew, expensive function/CTE/subquery nodes, and recommendations. Set analyze=false for plan-only (no execution). The single query-plan-analysis tool — covers what separate explain_analyze/analyze_query_plan tools used to.