Analyze MPP query plan
analyze_mpp_query_planRun EXPLAIN (ANALYZE, FORMAT JSON) on SQL to surface MPP slice counts, motion nodes, sender/receiver rows, and flag non-co-located joins.
Instructions
Run EXPLAIN (ANALYZE, FORMAT JSON) on sql and roll up MPP-specific facts: slice count, motion nodes (Redistribute Motion / Broadcast Motion / Gather Motion), and per-motion metadata (senders, receivers, estimated rows). Uses the same safety pre-flight as analyze_query_plan(io=True) — writes / DDL stay rejected. redistribute_count flags 'data is not co-located with the join key'. On vanilla PG returns available=false.
Example: analyze_mpp_query_plan(sql='SELECT * FROM big JOIN small ON big.k = small.k')
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": "analyze_mpp_query_plan"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| database | No | Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | Yes | ||
| motions | Yes | ||
| available | Yes | ||
| slice_count | Yes | ||
| gather_count | Yes | ||
| motion_count | Yes | ||
| broadcast_count | Yes | ||
| redistribute_count | Yes |