mysql 5.6 改进:
(1)online DDL
相关变量:
mysql> show global variables like ‘%alter%‘;
+----------------------------------+-----------+
| Variable_name | Value |
+----------------------------------+-----------+
| innodb_online_alter_log_max_size | 134217728 |
| old_alter_table | OFF |
+----------------------------------+-----------+
innodb_online_alter_log_max_size:alter缓存区,默认为128M
old_alter_table:是否启用online DDL
语法:
alter table t_name add index indx01(col),
algorithm = {default|inplace|copy},
lock ={default | none | share | exclusive}
原理:
从源表中cp数据到新表,并且记录下源表的所有数据变动,最后应用日志,更改表明。
note:开启online DDL 后 并不是所有的alter都能按照inplace方式进行,比如,change .
(2).MRR
相关变量:
mysql> show global variables like ‘%switch%‘\G ;
*************************** 1. row ***************************
Variable_name: optimizer_switch
Value: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
和mrr相关的参数有
mrr:开启mrr
mrr_cost_based:基于开销由mysql自己决定是否使用mrr
read_rnd_buffer_size:随机读缓存大小。
作用:
<1>将非顺序io转变为顺序io
<2>.拆分查询
(3).ICP
将数据的过滤放在存储引擎层
参考资料:
http://m.blog.csdn.net/blog/z1547840014/25377713
http://www.ruzuojun.com/topic/860.html
本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1706830
原文:http://dwchaoyue.blog.51cto.com/2826417/1706830