online ddl 使用、测试及关键函数栈
[MySQL 5.6] MySQL 5.6 online ddl 使用、测试及关键函数栈
前言
| Operation | In-Place? | Copies Table? | Allows Concurrent DML? | Allows Concurrent Query? | Notes |
|---|---|---|---|---|---|
CREATE INDEX,ADD INDEX |
Yes* | No* | Yes | Yes | Some restrictions for FULLTEXT index; see next row. Currently, the operation is not in-place (that is, it copies the table) if the same index being created was also dropped by an earlier clause in the sameALTER TABLE statement. |
ADD FULLTEXT INDEX |
Yes | No* | No | Yes | Creating the first FULLTEXT index for a table involves a table copy, unless there is a user-supplied FTS_DOC_ID column. Subsequent FULLTEXT indexes on the same table can be created in-place. |
DROP INDEX |
Yes | No | Yes | Yes | |
| Set default value for a column | Yes | No | Yes | Yes | Modifies .frm file only, not the data file. |
| Change auto-increment value for a column | Yes | No | Yes | Yes | Modifies a value stored in memory, not the data file. |
| Add a foreign key constraint | Yes* | No* | Yes | Yes | To avoid copying the table, disableforeign_key_checks during constraint creation. |
| Drop a foreign key constraint | Yes | No | Yes | Yes | The foreign_key_checks option can be enabled or disabled. |
| Rename a column | Yes* | No* | Yes* | Yes | To allow concurrent DML, keep the same data type and only change the column name. |
| Add a column | Yes | Yes | Yes* | Yes | Concurrent DML is not allowed when adding an auto-increment column. Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
| Drop a column | Yes | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
| Reorder columns | Yes | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
ChangeROW_FORMATproperty |
Yes | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
ChangeKEY_BLOCK_SIZEproperty |
Yes | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
Make columnNULL |
Yes | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
Make column NOT NULL |
Yes* | Yes | Yes | Yes | When SQL_MODE includesstrict_all_tables orstrict_all_tables, the operation fails if the column contains any nulls. Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. |
| Change data type of column | No | Yes | No | Yes | |
| Add primary key | Yes* | Yes | Yes | Yes | Although ALGORITHM=INPLACE is allowed, the data is reorganized substantially, so it is still an expensive operation. ALGORITHM=INPLACE is not allowed under certain conditions if columns have to be converted to NOT NULL. See Example 5.9, “Creating and Dropping the Primary Key”. |
| Drop primary keyand add another | Yes | Yes | Yes | Yes | ALGORITHM=INPLACE is only allowed when you add a new primary key in the same ALTER TABLE; the data is reorganized substantially, so it is still an expensive operation. |
| Drop primary key | No | Yes | No | Yes | Restrictions apply when you drop a primary key primary key without adding a new one in the same ALTER TABLEstatement. |
| Convert character set | No | Yes | No | Yes | Rebuilds the table if the new character encoding is different. |
| Specify character set | No | Yes | No | Yes | Rebuilds the table if the new character encoding is different. |
Rebuild withFORCE option |
No | Yes | No | Yes | Acts like the ALGORITHM=COPY clause or the setting old_alter_table=1. |
LOCK=ALGORITHM=[INPLACE|COPY] innodb_online_alter_log_max_size 需要注意,它表示在做在线DDL的过程中,并发DML产生的日志最大允许的大小。如果负载很高,这个值应该尽量的调大,否则可能导致DDL失败。 性能损耗
无压力负载测试:
mysql> set session old_alter_table = OFF;
Query OK, 0 rows affected (0.00 sec)
mysql> alter table sbtest1 add key (k);
Query OK, 0 rows affected (10.44 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 drop key k;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 add key(k), ALGORITHM=COPY;
Query OK, 1000000 rows affected (27.72 sec)
Records: 1000000 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 drop key k;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 add key(k), LOCK=SHARED;
Query OK, 0 rows affected (9.89 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 drop key k;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table sbtest1 add key(k), LOCK=EXCLUSIVE;
Query OK, 0 rows affected (10.07 sec)
Records: 0 Duplicates: 0 Warnings: 0
内部实现
8031 &ha_alter_info);
6391 goto rollback;
6392 }
6422 goto rollback;
6423 }
6449 {
6450 goto rollback;
6451 }
原创文章,转载请注明: 转载自Simple Life
online ddl 使用、测试及关键函数栈的更多相关文章
- c函数调用过程原理及函数栈帧分析
转载自地址:http://blog.csdn.net/zsy2020314/article/details/9429707 今天突然想分析一下函数在相互调用过程中栈帧的变化,还是想尽量以比 ...
- 自动化测试架构设计 &&自动化持续集成测试任务实战[线性测试、模块驱动测试、数据驱动测试、关键字驱动测试]
1 为什么设计自动化测试架构 1.1 企业现状分析 压力大:产品需求不明确,上线时间确定,压力山大. 混乱:未立项,开发时间已过半,前期无控制,后期无保障. 疲于应付:开发人员交付的文件质量差,测试跟 ...
- scala tail recursive优化,复用函数栈
在scala中如果一个函数在最后一步调用自己(必须完全调用自己,不能加其他额外运算子),那么在scala中会复用函数栈,这样递归调用就转化成了线性的调用,效率大大的提高.If a function c ...
- 谈谈arm下的函数栈
引言 这篇文章简要说说函数是怎么传入参数的,我们都知道,当一个函数调用使用少量参数(ARM上是少于等于4个)时,参数是通过寄存器进行传值(ARM上是通过r0,r1,r2,r3),而当参数多于4个时,会 ...
- broadcom6838开发环境实现函数栈追踪
在嵌入式设备开发中.内核为内核模块的函数栈追踪已经提供了非常好的支持,但用户层的函数栈追踪确没有非常好的提供支持. 在网上收集学习函数栈跟踪大部分都是描写叙述INTER体系架构支持栈帧的实现机制.或者 ...
- C++ Opencv 傅里叶变换的代码实现及关键函数详解
一.前言 最近几天接触了图像的傅里叶变换,数学原理依旧不是很懂,因此不敢在这里妄言.下午用Opencv代码实现了这一变换,有一些经验心得,愿与大家分享. 二.关键函数解析 2.1copyMakeBor ...
- [pixhawk笔记]6-uORB流程及关键函数解析
本文中将结合代码.文档及注释,给出uORB执行流程及关键函数的解析,由于uORB的机制实现较为复杂,所以本文主要学习如何使用uORB的接口来实现通信.回到上一篇笔记中的代码: #include < ...
- golang defer 以及 函数栈和return
defer 作为延迟函数存在,在函数执行结束时才会正式执行,一般用于资源释放等操作 参考一段代码https://mp.weixin.qq.com/s/yfH0CBnUBmH0oxfC2evKBA来分析 ...
- Cortex-M3双堆栈MSP和PSP+函数栈帧
为了防止几百年以后找不到该文章,特此转载 ------------------------------------------------开始转载--------------------------- ...
随机推荐
- 《Python基础教程(第二版)》学习笔记 -> 第十一章 文件和素材
打开文件 open函数用来打开文件,语句如下: open(name[,mode[,buffering]]) open函数使用一个文件名作为唯一的强制参数,然后后返回一个文件对象.模式(mode)和缓冲 ...
- Webservice 调用方式整理
前一段时间搞webservice,简单的记录了一下几种常用的调用方式,供大家参考. 第一种:Java proxy 1).用过eclipse的创建web service client来完成 2).在ec ...
- PackageManager获取版本号
PackageInfo代表的是关于一个包的所有信息,就相当于一个APP应用的清单文件中收集到的所有信息. 通过这个类我们就可以获取类似版本号等一些信息. /** * 得到应用程序的版本名称 */ pr ...
- 只有IE能上网,其他浏览器均不可以!
今天起来,高高兴兴的来到实验室,发现电脑打开上不了网.本人平时喜欢用Chrome,发现上不了网,就开始ping.发现可以ping通,但是网页打不开! 第一反应是DNS的问题,可以发现DNS没问题,能正 ...
- mount失败
又一次遇到mount失败,提示文件系统类型错误.选项错误.有坏超级块等.之前是在ubuntu 14.04 lts desktop上挂载windows下共享文件夹遇到的.这次具体的环境如下:CentOS ...
- 【转】Nginx系列(二)--模块化
原博文出于: http://blog.csdn.net/liutengteng130/article/details/46700977 感谢! 高度模块化的设计设Nginx架构的基础.在Nginx中 ...
- 生成Base58格式的UUID(Hibernate Base64格式的UUID续)
Base58简介 Base58采用的字符集合为“123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ”,从这不难看出,Base58是纯数 ...
- [一]Head First设计模式之【策略模式】(鸭子设计的优化历程)
public abstract class Duck { FlyBehavior flyBehavior; QuackBehavior quackBehavior; public Duck() { } ...
- cookie 编码问题
问题描述: Control character in cookie value or attribute. 解决方案: 1.前台编码 encodeURIComponent(str) 2.后台解码 原 ...
- 【Java】IO技术的使用——用IO实现大文件的复制
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/5827481.html 用IO进行文件复制,实质就是用FileInputStream链接要复制的文件,按一定规模 ...