这期内容当中小编将会给大家带来有关怎么理解MySQL 5.7 Online DDL Overview,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
Operation | In-Place? | Rebuilds Table? | Permits Concurrent DML? | Only Modifies Metadata? | Notes | CREATE INDEX,ADD INDEXYes*No*YesNoRestrictions apply forFULLTEXTindexes; see next row.ADD FULLTEXT INDEXYes*No*NoNoAdding the firstFULLTEXTindex rebuilds the table if there is no user-definedFTS_DOC_IDcolumn. SubsequentFULLTEXTindexes may be added on the same table without rebuilding the table.ADD SPATIAL INDEXYesNoNoNoRENAME INDEXYesNoYesYesOnly modifies table metadata.DROP INDEXYesNoYesYesOnly modifies table metadata.OPTIMIZE TABLEYes*YesYesNoIn-place operation is not supported for tables withFULLTEXTindexes.Set column default valueYesNoYesYesOnly modifies table metadata.Changeauto-incrementvalueYesNoYesNo*Modifies a value stored in memory, not the data file.Addforeign key constraintYes*NoYesYesTheINPLACEalgorithm is supported whenforeign_key_checksis disabled. Otherwise, only theCOPYalgorithm is supported.Dropforeign key constraintYesNoYesYesforeign_key_checkscan be enabled or disabled.Rename columnYes*NoYes*YesTo permit concurrent DML, keep the same data type and only change the column name.ALGORITHM=INPLACEis not supported for renaming agenerated column.Add columnYes*Yes*Yes*NoConcurrent DML is not permitted when adding anauto-incrementcolumn. Data is reorganized substantially, making it an expensive operation.ALGORITHM=INPLACEis supported for adding avirtual generated columnbut not for adding astored generated column. Adding a virtual generated column does not require a table rebuild.Drop columnYesYes*YesNoData is reorganized substantially, making it an expensive operation.ALGORITHM=INPLACEis supported for dropping a generated column. Dropping avirtual generated columndoes not require a table rebuild.Reorder columnsYesYesYesNoData is reorganized substantially, making it an expensive operation.ChangeROW_FORMATpropertyYesYesYesNoData is reorganized substantially, making it an expensive operation.ChangeKEY_BLOCK_SIZEpropertyYesYesYesNoData is reorganized substantially, making it an expensive operation.Make columnNULLYesYes*YesNoRebuilds the table in place. Data is reorganized substantially, making it an expensive operation.Make columnNOT NULLYes*YesYesNoRebuilds the table in place.STRICT_ALL_TABLESorSTRICT_TRANS_TABLESSQL_MODEis required for the operation to succeed. The operation fails if the column contains NULL values. The server prohibits changes to foreign key columns that have the potential to cause loss of referential integrity. SeeSection13.1.8, “ALTER TABLE Syntax”. Data is reorganized substantially, making it an expensive operation.Change column data typeNo*YesNoNoVARCHARsize may be increased using onlineALTER TABLE. SeeModifying Column Propertiesfor more information.Addprimary keyYes*Yes*YesNoRebuilds the table in place. Data is reorganized substantially, making it an expensive operation.ALGORITHM=INPLACEis not permitted under certain conditions if columns have to be converted toNOT NULL.Dropprimary keyand add anotherYesYesYesNoData is reorganized substantially, making it an expensive operation.Dropprimary keyNoYesNoNoOnlyALGORITHM=COPYsupports dropping a primary key without adding a new one in the sameALTER TABLEstatement.Convert character setNoYes*NoNoRebuilds the table if the new character encoding is different.Specify character setNoYes*NoNoRebuilds the table if the new character encoding is different.Rebuild withFORCEoptionYes*YesYesNoUsesALGORITHM=INPLACE.ALGORITHM=INPLACEis not supported for tables withFULLTEXTindexes.“null”rebuild usingALTER TABLE ... ENGINE=INNODBYes*YesYesNoUsesALGORITHM=INPLACE.ALGORITHM=INPLACEis not supported for tables withFULLTEXTindexes.SetSTATS_PERSISTENT,STATS_AUTO_RECALC,STATS_SAMPLE_PAGESpersistent statisticsoptionsYesNoYesYesOnly modifies table metadata.ALTER TABLE … ENCRYPTIONNoYesNoYesDrop aSTOREDcolumnYesYes*YesNoRebuilds the table in place.ModifySTOREDcolumn orderYesYes*YesNoRebuilds the table in place.Add aSTOREDcolumnYesYes*YesNoRebuilds the table in place.Drop aVIRTUALcolumnYesNoYesYesModifyVIRTUALcolumn orderYesNoYesYesAdd aVIRTUALcolumnYesNoYesYes
此列显示哪些操作允许使用ALGORITHM=INPLACE子句。“Rebuilds Table?”列显示哪些操作可以重建表。对于使用就地算法的操作,表将就地重建。对于不支持就地算法的操作,使用表复制方法重新生成表。
“允许并发DML?”列显示完全在线执行的操作。您可以指定LOCK=NONE来断言在DDL操作期间允许并发DML。MySQL在可能的情况下自动允许并发DML。
在所有联机DDL操作期间允许并发查询。您可以指定LOCK=SHARED来断言在DDL操作期间允许并发查询。MySQL在可能的情况下自动允许并发查询。
“注释”列提供附加信息,并解释与其他列的“是/否”值相关的异常和依赖关系。星号表示异常或依赖项。
上述就是小编为大家分享的怎么理解MySQL 5.7 Online DDL Overview了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。