SHOW ALTER TABLE
SHOW ALTER TABLE shows the execution of the ongoing ALTER TABLE operations, including:
- Modify columns.
- Optimize table schema (from v3.2), including modifying the bucketing method and the number of buckets.
- Create and delete the rollup index.
Syntaxβ
- 
Show the execution of operations of modifying columns or optimizing table schema. SHOW ALTER TABLE { COLUMN | OPTIMIZE } [FROM db_name] [WHERE TableName|CreateTime|FinishTime|State] [ORDER BY] [LIMIT]
- 
Show the execution of operations of adding or deleting the rollup index. SHOW ALTER TABLE ROLLUP [FROM db_name]
Parametersβ
- 
{COLUMN ο½ OPTIMIZE | ROLLUP}:- If COLUMNis specified, this statement shows operations of modifying columns.
- If OPTIMIZEis specified, this statement shows operations of optimizing table structure.
- If ROLLUPis specified, this statement shows operations of adding or deleting the rollup index.
 
- If 
- 
db_name: optional. Ifdb_nameis not specified, the current database is used by default.
Examplesβ
- 
Show the execution of operations of modifying columns, optimizing table schema, and creating or deleting the rollup index in the current database. SHOW ALTER TABLE COLUMN;
 SHOW ALTER TABLE OPTIMIZE;
 SHOW ALTER TABLE ROLLUP;
- 
Show the execution of operations related to modifying columns, optimizing table schema, and creating or deleting the rollup index in a specified database. SHOW ALTER TABLE COLUMN FROM example_db;
 SHOW ALTER TABLE OPTIMIZE FROM example_db;
 SHOW ALTER TABLE ROLLUP FROM example_db;
- 
Show the execution of the most recent operation of modifying columns or optimizing table schema in a specified table. SHOW ALTER TABLE COLUMN WHERE TableName = "table1" ORDER BY CreateTime DESC LIMIT 1;
 SHOW ALTER TABLE OPTIMIZE WHERE TableName = "table1" ORDER BY CreateTime DESC LIMIT 1;