我正在使用MySQL Server version: 5.6.15 Homebrew
. 我需要添加新null
列。alter table
不需要metadata
锁。为了避免这种MySQL 5.6
引入algorithm=inplace
。这里是参考文章http://www.mysqlperformanceblog.com/2013/07/05/schema-changes-whats-new-in-mysql-5-6/。
执行以下sql抛出
mysql> alter table candidate_candidate add column responsible_user_id int, algorithm=INPLACE, lock=NONE;
ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation.
Try ALGORITHM=COPY.
Run Code Online (Sandbox Code Playgroud)
有没有办法add column
不影响应用程序read/write
?
我在 5.6.14 上执行了完全相同的查询并得到了积极的结果:
alter table candidate_candidate add column responsible_user_id int, algorithm=INPLACE, lock=NONE;
Query OK, 0 rows affected (0.48 sec)
Records: 0 Duplicates: 0 Warnings: 0
Run Code Online (Sandbox Code Playgroud)
所以我确信这种操作可以在网上完成。您可能遇到一些异常,如下所示:http://dev.mysql.com/doc/refman/5.6/en/innodb-create-index-limitations.html
我的赌注是拥有过时的时间数据类型、外键或全文索引。桌上有这些吗?最近从 5.5 迁移?如果我错了,你能显示完整的吗CREATE TABLE
?
归档时间: |
|
查看次数: |
15508 次 |
最近记录: |