See also Changing the Character Set. 

•To add (or change) a table comment: 

ALTER TABLE t1 COMMENT = ’New table comment’; 

•Use ALTER TABLE  with the TABLESPACE  option to move InnoDB  tables between existing general tablespaces, file-per-table tablespaces, and the system tablespace. See Moving Tables Between Tablespaces Using ALTER TABLE. 

• ALTER TABLE ... TABLESPACE  operations always cause a full table rebuild, even if the TABLESPACE  attribute has not changed from its previous value. 

• ALTER TABLE ... TABLESPACE  syntax does not support moving a table from a temporary tablespace to a persistent tablespace. 

•The DATA DIRECTORY  clause, which is supported with CREATE TABLE ... TABLESPACE , is not supported with ALTER TABLE ... TABLESPACE , and is ignored if specified. 

•For more information about the capabilities and limitations of the TABLESPACE  option, see CREATE TABLE . 

•MySQL NDB Cluster 8.0 supports setting NDB_TABLE  options for controlling a table’s partition balance (fragment count type), read-from-any-replica capability, full replication, or any combination of these, as part of the table comment for an ALTER TABLE  statement in the same manner as for CREATE TABLE , as shown in this example: 

ALTER TABLE t1 COMMENT = "NDB_TABLE=READ_BACKUP=0,PARTITION_BALANCE=FOR_RA_BY_NODE"; 

Bear in mind that ALTER TABLE ... COMMENT ...  discards any existing comment for the table. See Setting NDB_TABLE options, for additional information and examples. 

• ENGINE_ATTRIBUTE  and SECONDARY_ENGINE_ATTRIBUTE  options (available as of MySQL 8.0.21) are used to specify table, column, and index attributes for primary and secondary storage engines. The options are reserved for future use. Index attributes cannot be altered. An index must be dropped and added back with the desired change, which can be performed in a single ALTER TABLE  statement. 

To verify that the table options were changed as intended, use SHOW CREATE TABLE , or query the INFORMATION_SCHEMA.TABLES  table. 

## Performance and Space Requirements 

ALTER TABLE  operations are processed using one of the following algorithms: 

• 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. 

• 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. 

• 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) 

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. 

