mysql裡alter table 重定義主鍵的步驟:

rainbowbridg發表於2012-05-25
Processing CREATE INDEXConsider an example. If you use the ALTER TABLE command to
redefine the primary key of table T (or otherwise cause the clustered index to be recreated, for example by compressing an uncompressed table),
the InnoDB Plugin will perform the following sequence of steps:

Lock table T in exclusive mode.
Create a new temporary table T1, with the new index structure.
Copy data from table T to temporary table T1.
Rename the original table T to temporary table T2.
Rename table T1 (the new table) to T (the original table name).
Drop table T2 (the original table, with the old index structure).
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7916042/viewspace-1058344/,如需轉載,請註明出處,否則將追究法律責任。

相關文章