返回顶部
首页 > 资讯 > 数据库 >MySQL5.6 Online DDL 是否锁表、rebuild表、inplace的说明
  • 492
分享到

MySQL5.6 Online DDL 是否锁表、rebuild表、inplace的说明

2024-04-02 19:04:59 492人浏览 独家记忆
摘要

Online DDL 是否锁表、是否rebuild表、inplace或copy算法的说明:原文: https://dev.Mysql.com/doc/refman/5.6/en/innodb-cr

Online DDL 是否锁表、是否rebuild表、inplace或copy算法的说明:

原文: https://dev.Mysql.com/doc/refman/5.6/en/innodb-create-index-overview.html?spm=5176.100239.bloGCont64664.13.SpL8lH

OperationIn-Place?Rebuilds Table?Permits Concurrent DML?Only Modifies Metadata?Notes
CREATE INDEXADD INDEXYes*No*YesNoRestrictions apply for FULLTEXT indexes; see next row.
ADD FULLTEXT INDEXYes*No*NoNoAdding the first FULLTEXT index rebuilds the table if there is no user-defined FTS_DOC_ID column. Subsequent FULLTEXT indexes may be added on the same table without rebuilding the table.
DROP INDEXYesNoYesYesOnly modifies table metadata.
OPTIMIZE TABLEYes*YesYesNoPerfORMed in-place as of mysql 5.6.17. In-place operation is not supported for tables withFULLTEXT indexes.
Set column default valueYesNoYesYesOnly modifies table metadata.
Change auto-incrementvalueYesNoYesNo*Modifies a value stored in memory, not the data file.
Add foreign key constraintYes*NoYesYesThe INPLACE alGorithm is supported when foreign_key_checks is disabled. Otherwise, only theCOPY algorithm is supported.
Drop foreign key constraintYesNoYesYesforeign_key_checks can be enabled or disabled.
Rename columnYesNoYes*YesTo permit concurrent DML, keep the same data type and only change the column name.
Add columnYesYesYes*NoConcurrent DML is not permitted when adding an auto-increment column. Data is reorganized substantially, making it an expensive operation.
Drop columnYesYesYesNoData is reorganized substantially, making it an expensive operation.
Reorder columnsYesYesYesNoData is reorganized substantially, making it an expensive operation.
Change ROW_FORMATpropertyYesYesYesNoData is reorganized substantially, making it an expensive operation.
Change KEY_BLOCK_SIZEpropertyYesYesYesNoData is reorganized substantially, making it an expensive operation.
Make column NULLYesYes*YesNoRebuilds the table in place. Data is reorganized substantially, making it an expensive operation.
Make column NOT NULLYes*Yes*YesNoRebuilds the table in place. STRICT_ALL_TABLES or STRICT_TRANS_TABLES sql_MODE is required for the operation to succeed. The operation fails if the column contains NULL values. As of 5.6.7, the server prohibits changes to foreign key columns that have the potential to cause loss of referential integrity. See Section 13.1.7, “ALTER TABLE Syntax”. Data is reorganized substantially, making it an expensive operation.
Change column data typeNoYesNoNoOnly supports ALGORITHM=COPY
Add primary keyYes*Yes*YesNoRebuilds the table in place. Data is reorganized substantially, making it an expensive operation.ALGORITHM=INPLACE is not permitted under certain conditions if columns have to be converted toNOT NULL.
Drop primary key and add anotherYesYesYesNoData is reorganized substantially, making it an expensive operation.
Drop primary keyNoYesNoNoOnly ALGORITHM=COPY supports dropping a primary key without adding a new one in the sameALTER TABLE statement.
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 with FORCEoptionYes*YesYesNoUses ALGORITHM=INPLACE as of MySQL 5.6.17. ALGORITHM=INPLACE is not supported for tables withFULLTEXT indexes.
“null” rebuild usingALTER TABLE ... ENGINE=INNODBYes*YesYesNoUses ALGORITHM=INPLACE as of MySQL 5.6.17. ALGORITHM=INPLACE is not supported for tables withFULLTEXT indexes.
Set STATS_PERSISTENT,STATS_AUTO_RECALC,STATS_SAMPLE_PAGESpersistent statisticsoptionsYesNoYesYesOnly modifie

其余可参考文章: Https://yq.aliyun.com/articles/64664


您可能感兴趣的文档:

--结束END--

本文标题: MySQL5.6 Online DDL 是否锁表、rebuild表、inplace的说明

本文链接: https://lsjlt.com/news/43702.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作