更新时间:2023-11-18 22:47:40
是的。但是......
Yes. But...
在旧版本中,使用
ALTER TABLE tbl
ADD INDEX(...),
ADD INDEX(...);
这样它就可以一次性完成所有工作。
so that it will do all the work in one pass.
在较新的版本中, ALGORITHM = INPLACE
使得可以在InnoDB表的后台中完成工作,从而减少对其他表的影响处理。但是,要获得 INPLACE
处理,您可能需要单独添加每个索引。
In newer versions, ALGORITHM=INPLACE
makes it so that the work can be done in the "background" for InnoDB tables, thereby having less impact on other processing. However, to get the INPLACE
processing, you may need to add the each index separately.
参考手册列出了一些警告,例如处理 PRIMARY KEY
。
The Ref manual lists some caveats, such as dealing with PRIMARY KEY
.