schema_explorer_reshard_script
Generates a DBA-ready SQL script to change a table’s shard key: builds a replacement table, copies data, checks row count and skew, and swaps tables.
Instructions
"Change shard key…": a SQL script for a DBA (nothing runs). CREATE TABLE __reshard
from the real SHOW CREATE TABLE with only the SHARD KEY replaced, INSERT … SELECT, a row-count and skew check, the
rename swap and a commented-out DROP of the old table, with warnings filled in for this table (size, pipelines,
views, grants, duration). Read-only (logic and docs in ..reshard).
Args:
database: Database (case-sensitive).
table: Table (case-sensitive).
columns: The new shard key's columns, as the table spells them.
simulation: The simulation result's numbers (rsd_pct, current_rsd_pct, elapsed_ms, fraction,
partition_count) for the header and the duration estimate; optional.
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": {
"database": "<database>",
"table": "<table>",
"columns": "<columns>"
},
"name": "schema_explorer_reshard_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| columns | Yes | ||
| database | Yes | ||
| simulation | No |