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).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "explain_query"
}
}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. |