mysql - MySQL 8.0 Alter Table Algorithm=INSTANT 未按预期工作(需要 40 秒)
问题描述
MySQL 8.0 - 如MySQL Official Doc和MySQL Server Team中所述,Algorithm=INSTANT 的 Alter table 立即添加列而无需任何锁定。
但是,结果不一样。
测试设置- 具有 40M 行的表。在表上读取和写入 (1000 TPS)。表模式非常简单。
field,type,null,key,default,extra
id,bigint(20),NO,PRI,,auto_increment
t_a,bigint(20),NO,MUL,,""
t_b,bigint(20),NO,MUL,,""
t_c,int(11),NO,"",1,""
基础设施: AWS RDS MySQL 8 - 引擎版本 - 8.0.17
测试用例: 向表中添加新列。
陈述:
alter table table_name add column_name int, algorithm=instant;
结果:
mysql> alter table test_table add test_column int, algorithm=instant;
Query OK, 0 rows affected (36.06 sec)
Records: 0 Duplicates: 0 Warnings: 0
它花了〜40秒。它在 40 秒内阻止了读取和写入
这是预期的吗?有什么我想念的吗?
解决方案
推荐阅读
- sql - SQL:从超集中检索缺失值
- django - 如何限制用户查看 swagger 端点文档但不使用它们?
- amazon-web-services - 我可以从 AWS S3 下载文件夹吗?
- sql - 如果 Right Join Select 不存在,是否允许 Null?
- css - React 图标 - 更改背景颜色
- php - 如何从 textarea 中的多个 URL 获取 ID?
- python-3.x - Tkinter - 如何更改设置为“只读”模式的 TTK Lable 小部件的背景颜色?
- c - 矩形的动态边框
- html - Excel VBA 在网页上选择导航选项卡
- facebook - facebook 说缺少以下必需属性:og:url,og:type,og:title,og:image,og:description,fb:app_id