# Tidb Online Ddl

__*Online DDL*__

+ `ALTER TABLE ... ADD/DROP/MODIFY COLUMN column_name [options]` 
+ DML does not block DDL from other sessions
+ It is recommended that the client should handle exceptions: `ERROR 8028 (HY000)` 
+ Monitor and cancel actions
  + `ADMIN SHOW DDL;` 
  + `ADMIN SHOW DDL JOBS;`  
  + `ADMIN SHOW DDL JOB QUERIES <job_id>;`  
  + `ADMIN CANCEL DDL JOBS <job_id>;` 
```12
ALTER TABLE test.target_table ~!@ADD@!~ COLUMN name char(30);
ALTER TABLE test.target_table ~!@MODIFY@!~ COLUMN name char(40);
ALTER TABLE test.target_table ~!@DROP@!~ COLUMN name;
```
------------------------------------------------------------

Class demo scripts:

https://github.com/pingcap/tidb-course-201-lab/blob/master/scripts/07-demo-online-ddl-add-column-01-workload-before.sh

https://github.com/pingcap/tidb-course-201-lab/blob/master/scripts/07-demo-online-ddl-add-column-02-workload-after.sh



Since DML operations do not block DDL operations from other sessions, when a DML in a transaction encounters a table schema change, you can choose to abandon the transaction or re-commit it.
