Explain one query
explain_queryDiagnose slow SQL by retrieving its PostgreSQL execution plan, and enable analyze to run the query read-only and report measured timings and buffer usage.
Instructions
Why THIS statement is slow: the PostgreSQL execution plan for a query you provide. With analyze=true it actually runs the query and reports measured timings and buffer usage (still read-only, still rolled back). Use it on a specific statement; use top_queries to find out which statement to look at.
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 | ||
| analyze | No | run the query and report real timings instead of estimates | |
| database | No | which configured database to use; omit when only one is configured |