content_image/665103.jpg
clustered index is renamed with the name of the original table, and the original table is dropped from the database. 

The online performance enhancements that apply to operations on secondary indexes do not apply to the primary key index. The rows of an InnoDB table are stored in a clustered index organized based on the primary key, forming what some database systems call an “index-organized table” . Because the table structure is closely tied to the primary key, redefining the primary key still requires copying the data. 

When an operation on the primary key uses ALGORITHM=INPLACE , even though the data is still copied, it is more efficient than using ALGORITHM=COPY  because: 

•No undo logging or associated redo logging is required for ALGORITHM=INPLACE . These operations add overhead to DDL statements that use ALGORITHM=COPY . 

•The secondary index entries are pre-sorted, and so can be loaded in order. 

•The change buffer is not used, because there are no random-access inserts into the secondary indexes. 

•Dropping a primary key 

ALTER TABLE tbl_name  DROP PRIMARY KEY, ALGORITHM=COPY; 

Only ALGORITHM=COPY  supports dropping a primary key without adding a new one in the same ALTER TABLE  statement. 

•Dropping a primary key and adding another 

ALTER TABLE tbl_name  DROP PRIMARY KEY, ADD PRIMARY KEY ( column ), ALGORITHM=INPLACE, LOCK=NONE; 

## Column Operations 

Data is reorganized substantially, making it an expensive operation. 

The following table provides an overview of online DDL support for column operations. An asterisk indicates additional information, an exception, or a dependency. For details, see Syntax and Usage Notes. 

<img src='content_image/665103.jpg'>

