Online DDL Failure Conditions For DDL operations that can be done online, you can separate them into individual  ALTER TABLE statements for easier scripting and maintenance, without sacrificing efficiency. For example, you might take a complicated statement such as: and break it down into simpler parts that can be tested and performed independently, such as: You might still use multi-part  ALTER TABLE  statements for: The failure of an online DDL operation is typically due to one of the following conditions: The following limitations apply to online DDL operations: •The table is copied when creating an index on a  TEMPORARY TABLE . •Concurrent DML makes changes to the table that are allowed with the original table definition, but not with the new one. The operation only fails at the very end, when MySQL tries to apply all the changes from concurrent DML statements. For example, you might insert duplicate values into a column while a unique index is being created, or you might insert  NULL  values into a column while creating a primary key index on that column. The changes made by the concurrent DML take precedence, and the  ALTER TABLE  operation is effectively rolled back. •The operation takes a long time and concurrent DML modifies the table so much that the size of the temporary online log exceeds the value of the  innodb_online_alter_log_max_size  configuration option. This condition causes a  DB_ONLINE_LOG_TOO_BIG  error. •The  tmpdir  or  innodb_tmpdir  file system runs out of disk space, while MySQL writes temporary sort files on disk during index creation. For more information, see Section 15.12.3, “Online DDL Space Requirements” . •A timeout occurs while waiting for an exclusive lock on the table, which may be needed briefly during the initial and final phases of the DDL operation. •A  LOCK  clause specifies a low degree of locking ( SHARED  or  NONE ) that is not compatible with the particular type of DDL operation. •An  ALGORITHM  clause specifies an algorithm that is not compatible with the particular type of DDL operation or storage engine. •Operations that must be performed in a specific sequence, such as creating an index followed by a foreign key constraint that uses that index. •Operations all using the same specific  LOCK  clause, that you want to either succeed or fail as a group. •Operations that cannot be performed online, that is, that still use the table-copy method. •Operations for which you specify  ALGORITHM=COPY  or  old_alter_table=1 , to force the table- copying behavior if needed for precise backward-compatibility in specialized scenarios. ALTER TABLE t1 ADD INDEX i1(c1), ADD UNIQUE INDEX i2(c2), CHANGE c4_old_name c4_new_name INTEGER UNSIGNED; ALTER TABLE t1 ADD INDEX i1(c1); ALTER TABLE t1 ADD UNIQUE INDEX i2(c2); ALTER TABLE t1 CHANGE c4_old_name c4_new_name INTEGER UNSIGNED NOT NULL; 15.12.5 Online DDL Failure Conditions 15.12.6 Online DDL Limitations 3195