Explain a query
explain_queryShows the PostgreSQL execution plan for a SELECT query with node types, scans, and index suggestions; optionally executes it for real timings when enabled.
Instructions
Shows the PostgreSQL execution plan of a SELECT with a summary (node types, sequential scans, index suggestions). analyze=true executes the query and is only available if the server enables it.
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 | ||
| params | No | ||
| analyze | No | Execute the query to get actual timings (if enabled) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan | Yes | ||
| summary | Yes |