explain_query
Retrieve the execution plan for a SQL query, with optional hypothetical index simulation to test performance improvements.
Instructions
Get the query execution plan. Supports hypothetical index simulation (requires hypopg extension).
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 | SQL query to explain | |
| analyze | No | Run EXPLAIN ANALYZE (executes the query — use with care on write queries in unrestricted mode) | |
| database | No | Database alias to query. Omit to use the primary database. | |
| hypothetical_indexes | No | Hypothetical indexes to simulate (requires hypopg extension) |