(這是個彙總文章,後續有新的online ddl操作 會不斷更新…)
1. 支援alter table t1 rename index idx1 to idx2;
(server層)文法支援的worklog: http://dev.mysql.com/worklog/task/?id=6555
(innodb層)online ddl的worklog: http://dev.mysql.com/worklog/task/?id=6752
新增了文法支援rename index操作:
mysql> create table t1 (a int, b int, index x1(a));
query ok, 0 rows affected (0.00 sec)
mysql> alter table t1 rename index x1 to x2;
records: 0 duplicates: 0 warnings: 0
主要包含三個過程:
1. renaming in innodb data dictionary (sys_indexes)
2. renaming in innodb data dictionary cache (the dict_table_t/dict_index_t
objects)
3. renaming in innodb persistent stats storage
ref patch: http://bazaar.launchpad.net/~mysql/mysql-server/5.7/revision/5116
2. 支援線上增加varchar列的長度 (反之,如果縮小列長度,則隻支援copy algorithm)
worklog: http://dev.mysql.com/worklog/task/?id=6554
目前隻支援在255位元組内的長度使用in-place算法,原因是超過255位元組,innodb層存儲資料表示列長度的部分就得多擴充一個位元組。
不支援in-place 減小字段長度:
在滿足上述情況下,直接更新innodb 系統表sys_columns即可。
mysql> create table t1 (a varchar(100));
mysql> alter table t1 algorithm=inplace, change column a a varchar(5);
error 1846 (0a000): algorithm=inplace is not supported. reason: cannot change column type inplace. try algorithm=copy.
mysql> alter table t1 algorithm=inplace, change column a a varchar(200);
query ok, 0 rows affected (0.01 sec)
mysql> alter table t1 algorithm=inplace, change column a a varchar(256);
ref patch:http://bazaar.launchpad.net/~mysql/mysql-server/5.7/revision/5107.1.230
<a href="http://dev.mysql.com/worklog/task/?id=6554" target="_blank">wl#6554</a>