Recommend redistribute
recommend_redistributeAnalyze hash-distribution skew and recommend a higher-cardinality distribution key, returning ranked candidates and suggested DDL for review without executing changes.
Instructions
Distribution-skew advisor for a hash-distributed table. Reads pg_stats.n_distinct for every column on the table and suggests a better hash key when the current one is low-cardinality. Pure catalog read — no per-segment scans. Returns ranked candidates, optional recommendation, and ready-to-review suggested_ddl (ALTER TABLE … SET WITH (REORGANIZE=TRUE) DISTRIBUTED BY (col)). Diagnosis-only — never executes. On vanilla PG returns available=false.
Example: recommend_redistribute(schema='public', table='fact_sales')
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": {
"schema": "<schema>",
"table": "<table>"
},
"name": "recommend_redistribute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| schema | 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 |
|---|---|---|---|
| table | Yes | ||
| detail | Yes | ||
| schema | Yes | ||
| available | Yes | ||
| candidates | Yes | ||
| suggested_ddl | Yes | ||
| current_method | Yes | ||
| recommendation | Yes | ||
| current_columns | Yes |