mysql 8.0 alter table ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}

The ALGORITHM clause is optional. If the ALGORITHM clause is omitted, MySQL uses ALGORITHM=INSTANT for storage engines and ALTER TABLE clauses that support it. Otherwise, ALGORITHM=INPLACE is used. If ALGORITHM=INPLACE is not supported, ALGORITHM=COPY is used.

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.

ALGORITHM = DEFAULT

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.


ALGORITHM = INSTANT

Operations only modify metadata in the data dictionary. No exclusive metadata locks are taken on the table during preparation and execution, and table data is unaffected, making operations instantaneous.
Concurrent DML is permitted. (Introduced in MySQL 8.0.12)


ALGORITHM = INPLACE

Operations avoid copying table data but may rebuild the table in place. An exclusive metadata lock on the table may be taken briefly during preparation and execution phases of the operation.
Typically, concurrent DML is supported.


ALGORITHM = COPY

Operations are performed on a copy of the original table, and table data is copied from the original table to the new table row by row.
Concurrent DML is not permitted.


参考:
https://dev.mysql.com/doc/refman/8.0/en/alter-table.html

你可能感兴趣的:(#,mysql,opti,table,index,algorithm,default,instant,inplace,copy)