explain_query
Analyze a SQL query's execution plan with cost estimates and optimization warnings. Optionally run ANALYZE for actual execution statistics on read-only queries.
Instructions
Run EXPLAIN on a SQL query and return a formatted plan with cost estimates, node types, and optimization warnings. Optionally runs EXPLAIN ANALYZE for actual execution statistics (read-only queries only).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The SQL query to explain | |
| analyze | No | Run EXPLAIN ANALYZE to get actual execution times (executes the query). Only allowed for SELECT queries. | |
| timeout_ms | No | Connection timeout in milliseconds (default: 30000). Increase for slow or remote databases. |