Explain Database Query
unfour.db.explainRun EXPLAIN on a read query for a saved database connection to inspect the query plan before optimizing slow SELECT/WITH statements. Returns structured plan rows, duration, and truncation details.
Instructions
Runs EXPLAIN for a read query against a saved database connection through the Unfour command bus. Use before optimizing slow SELECT/WITH queries. This is read-only in dev/test/prod; it returns structured columns/rows, durationMs, and truncation metadata.
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": {
"connectionId": "<connectionId>",
"sql": "<sql>"
},
"name": "unfour.db.explain"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| schema | No | ||
| catalog | No | ||
| timeoutMs | No | ||
| workspaceId | No | ||
| connectionId | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| sql | Yes | ||
| rows | No | ||
| source | Yes | ||
| columns | No | ||
| rowCount | No | ||
| truncated | No | ||
| durationMs | No | ||
| connectionId | Yes |