当达到行版本64次限制时,操作将被拒绝,
并给出错误信息,建议使用 COPY 或 INPLACE 算法重建表。
4092 (HY000): Maximum row versions reached for table test/t1.
No more columns can be added or dropped instantly. Please use COPY/INPLACE.
自 MySQL 9.1.0 起,次数上升为 255。
复现
-- 创建测试表
-- 使用存储过程来执行65次ALTER TABLE操作
-- 执行存储过程
-- 查看次数
参考手册:
When a table with instantly added or dropped columns is rebuilt by table-rebuilding ALTER TABLE or OPTIMIZE TABLE operation, the
TOTAL_ROW_VERSIONS
value is reset to 0. The maximum number of row versions permitted is 64 (255 as of MySQL 9.1.0), as each row version requires additional space for table metadata. When the row version limit is reached,ADD COLUMN
andDROP COLUMN
operations usingALGORITHM=INSTANT
are rejected with an error message that recommends rebuilding the table using theCOPY
orINPLACE
algorithm.
ERROR 4080 (HY000): Maximum row versions reached for table test/t1. No more columns can be added or dropped instantly. Please use COPY/INPLACE.
https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl-operations.html