ALTER TABLE Statement Specifying an  ALGORITHM  clause requires the operation to use the specified algorithm for clauses and storage engines that support it, or fail with an error otherwise. Specifying  ALGORITHM=DEFAULT  is the same as omitting the  ALGORITHM  clause. ALTER TABLE  operations that use the  COPY  algorithm wait for other operations that are modifying the table to complete. After alterations are applied to the table copy, data is copied over, the original table is deleted, and the table copy is renamed to the name of the original table. While the  ALTER TABLE operation executes, the original table is readable by other sessions (with the exception noted shortly). Updates and writes to the table started after the  ALTER TABLE  operation begins are stalled until the new table is ready, then are automatically redirected to the new table. The temporary copy of the table is created in the database directory of the original table unless it is a  RENAME TO  operation that moves the table to a database that resides in a different directory. The exception referred to earlier is that  ALTER TABLE  blocks reads (not just writes) at the point where it is ready to clear outdated table structures from the table and table definition caches. At this point, it must acquire an exclusive lock. To do so, it waits for current readers to finish, and blocks new reads and writes. An  ALTER TABLE  operation that uses the  COPY  algorithm prevents concurrent DML operations. Concurrent queries are still allowed. That is, a table-copying operation always includes at least the concurrency restrictions of  LOCK=SHARED  (allow queries but not DML). You can further restrict concurrency for operations that support the  LOCK  clause by specifying  LOCK=EXCLUSIVE , which prevents DML and queries. For more information, see Concurrency Control. To force use of the  COPY  algorithm for an  ALTER TABLE  operation that would otherwise not use it, specify ALGORITHM=COPY  or enable the  old_alter_table  system variable. If there is a conflict between the old_alter_table  setting and an  ALGORITHM  clause with a value other than  DEFAULT , the  ALGORITHM clause takes precedence. For  InnoDB  tables, an  ALTER TABLE  operation that uses the  COPY  algorithm on a table that resides in a shared tablespace can increase the amount of space used by the tablespace. Such operations require as much additional space as the data in the table plus indexes. For a table residing in a shared tablespace, the additional space used during the operation is not released back to the operating system as it is for a table that resides in a file-per-table tablespace. For information about space requirements for online DDL operations, see Section 15.12.3, “Online DDL Space Requirements” . ALTER TABLE  operations that support the  INPLACE  algorithm include: • ALTER TABLE  operations supported by the  InnoDB  online DDL feature. See Section 15.12.1, “Online DDL Operations” . •Renaming a table. MySQL renames files that correspond to the table  tbl_name  without making a copy. (You can also use the  RENAME TABLE  statement to rename tables. See Section 13.1.36, “RENAME TABLE Statement” .) Privileges granted specifically for the renamed table are not migrated to the new name. They must be changed manually. •Operations that only modify table metadata. These operations are immediate because the server does not touch table contents. Metadata-only operations include: •Renaming a column. In NDB Cluster 8.0.18 and later, this operation can also be performed online. •Changing the default value of a column (except for  NDB  tables). •Modifying the definition of an  ENUM  or  SET  column by adding new enumeration or set members to the end  of the list of valid member values, as long as the storage size of the data type does not change. For example, adding a member to a  SET  column that has 8 members changes the required storage 2487