红薯 MySQL 5.5 和 5.6 默认参数值的差异
2013-02-28 10:39
302 查看
作为MySQL5.5和5.6性能比较的一部分,我研究了下两个版本默认参数的差异,为了了解差异内容,我使用如下的SQL语句分别在MySQL5.5和5.6版本进行查询,得出下表(点击图片查看大图):
让我们来看看这些差异的配置中最重要的也是影响最大的部分:
performance_schema在MySQL5.6中默认是开启的,但相关的很多参数相比MySQL5.5却是降低了,例如performance_schema自动调整到445个表和224线程,比MySQL5.5低。尽管默认max_connections只是150,比200还小。
innodb_stats_on_metadata在MySQL5.6默认关闭,使得information_schema的查询速度快很多。
innodb_log_file_size–默认值从5MB提升到50MB,这是一个好的改变,虽然我觉得这个默认数值还可以再大些。对于写负载高的情况下,默认配置的MySQL5.6性能更好。
back_log改动比较小,从50改为80。如果系统每秒处理的连接数很高,还需要继续提高这个配置的值。
open_files_limit由原来的1024改为5000
innodb_auto_extend_increment由8MB改为64MB,可帮助降低碎片。
max_connect_errors从10改为100,可降低潜在的连接堵塞,但还可以更高些。
sort_buffer_size从2M将为256K,这可避免小排序导致的资源浪费,但是对大的排序有负面的影响。
max_allowed_packet从1MB改为4MB让MySQL可处理更大的查询。
join_buffer_size从128K改为256K,我觉得这个改动影响不大。
table_open_cache从400提高到2000,挺好!
innodb_buffer_pool_instances从1改为8,用于优化更高并发的负载。
query_cache_type和query_cache_size.Thebehavioris“nocache”bydefaultstillbutitisachieveddifferentlynow.Thequery_cache_typeisnowoffbydefaultwithdefaultsizeof1MBwhileinMySQL5.5andbeforeitwas“ON”bydefaultwithquerycachesizeof0whichmakesitdisabled.Iwishquery_cache_sizethoughwouldbelargerbydefaultasvalueof1Mistoosmalltobepracticalifsomeonetriestoenableit.
sql_modehasNO_ENGINE_SUBSTITUTIONvaluebydefaultwhichisgoodchangeastryingtocreateInnodbtablebutgettingMyISAMbecauseInnodbwasdisabledforsomereasonwasveryerrorpronegotcha.NotethisisasfarasMySQL5.6goes-STRICT_MODEandothersaferbehaviorsarenotenabledbydefault.
innodb_old_blocks_time设置为1000,很好的改变,默认扫描InnoDB缓冲池大小。
thread_cache_size默认启用,对很多连接和断开连接操作的情况下有帮助。
sync_relay_log_infoandsync_master_info默认值有原来的0改为10000.该改动几乎不会影响负载。
secure_auth默认开启,要求新的密码握手,特别是阻止老的不安全的做法,很好!
innodb_concurrency_ticketshasbeenincreasedfrom500to5000.Ifyou’reusinginnodb_thread_concurrencythiswillreduceoverheadassociatedwithgrabbingandreleasinginnodb_thread_concurrencyslotbutwillincreasepotentialstarvationofqueuedthreadsespeciallyforIOboundworkloads.Mostuserswillnotbeaffectedthoughasinnodb_thread_concurrencyis0bydefaultsothisqueuingfeatureisdisabled.
innodb_purge_threads默认为1,使用专用的后台purge线程,好!
innodb_open_files由300改为2000,好!
innodb_data_file_pathgotasmallchangewithstartingibdata1sizeraisedfrom10Mto12M.I’mnotsurewhatisthepurposeofthischangebutitisunlikelytohaveanypracticalmeaningforusers.Consideringthedefaultinnodb_auto_extend_incrementis64startingwith64Mmighthavemademoresense.
innodb_purge_patch_size从20改为300.
innodb_file_per_table默认启用,这个改变很大,而且很棒。特别是当你的表非常大的时候。
optimizer_switchisthecatchallvariableforalotofoptimizeroptions.Iwonderwhywasnotitimplementedasnumberofdifferentvariableswhichwouldmakemoresenseinmyopinion.MySQL5.6addsalotmoreoptimizerswitcheswhichyoucanplaywith:
总结:MySQL5.6对默认配置进行了一些微调,这些调整大多数都非常不错。
让我们来看看这些差异的配置中最重要的也是影响最大的部分:
performance_schema在MySQL5.6中默认是开启的,但相关的很多参数相比MySQL5.5却是降低了,例如performance_schema自动调整到445个表和224线程,比MySQL5.5低。尽管默认max_connections只是150,比200还小。
innodb_stats_on_metadata在MySQL5.6默认关闭,使得information_schema的查询速度快很多。
innodb_log_file_size–默认值从5MB提升到50MB,这是一个好的改变,虽然我觉得这个默认数值还可以再大些。对于写负载高的情况下,默认配置的MySQL5.6性能更好。
back_log改动比较小,从50改为80。如果系统每秒处理的连接数很高,还需要继续提高这个配置的值。
open_files_limit由原来的1024改为5000
innodb_auto_extend_increment由8MB改为64MB,可帮助降低碎片。
max_connect_errors从10改为100,可降低潜在的连接堵塞,但还可以更高些。
sort_buffer_size从2M将为256K,这可避免小排序导致的资源浪费,但是对大的排序有负面的影响。
max_allowed_packet从1MB改为4MB让MySQL可处理更大的查询。
join_buffer_size从128K改为256K,我觉得这个改动影响不大。
table_open_cache从400提高到2000,挺好!
innodb_buffer_pool_instances从1改为8,用于优化更高并发的负载。
query_cache_type和query_cache_size.Thebehavioris“nocache”bydefaultstillbutitisachieveddifferentlynow.Thequery_cache_typeisnowoffbydefaultwithdefaultsizeof1MBwhileinMySQL5.5andbeforeitwas“ON”bydefaultwithquerycachesizeof0whichmakesitdisabled.Iwishquery_cache_sizethoughwouldbelargerbydefaultasvalueof1Mistoosmalltobepracticalifsomeonetriestoenableit.
sql_modehasNO_ENGINE_SUBSTITUTIONvaluebydefaultwhichisgoodchangeastryingtocreateInnodbtablebutgettingMyISAMbecauseInnodbwasdisabledforsomereasonwasveryerrorpronegotcha.NotethisisasfarasMySQL5.6goes-STRICT_MODEandothersaferbehaviorsarenotenabledbydefault.
innodb_old_blocks_time设置为1000,很好的改变,默认扫描InnoDB缓冲池大小。
thread_cache_size默认启用,对很多连接和断开连接操作的情况下有帮助。
sync_relay_log_infoandsync_master_info默认值有原来的0改为10000.该改动几乎不会影响负载。
secure_auth默认开启,要求新的密码握手,特别是阻止老的不安全的做法,很好!
innodb_concurrency_ticketshasbeenincreasedfrom500to5000.Ifyou’reusinginnodb_thread_concurrencythiswillreduceoverheadassociatedwithgrabbingandreleasinginnodb_thread_concurrencyslotbutwillincreasepotentialstarvationofqueuedthreadsespeciallyforIOboundworkloads.Mostuserswillnotbeaffectedthoughasinnodb_thread_concurrencyis0bydefaultsothisqueuingfeatureisdisabled.
innodb_purge_threads默认为1,使用专用的后台purge线程,好!
innodb_open_files由300改为2000,好!
innodb_data_file_pathgotasmallchangewithstartingibdata1sizeraisedfrom10Mto12M.I’mnotsurewhatisthepurposeofthischangebutitisunlikelytohaveanypracticalmeaningforusers.Consideringthedefaultinnodb_auto_extend_incrementis64startingwith64Mmighthavemademoresense.
innodb_purge_patch_size从20改为300.
innodb_file_per_table默认启用,这个改变很大,而且很棒。特别是当你的表非常大的时候。
optimizer_switchisthecatchallvariableforalotofoptimizeroptions.Iwonderwhywasnotitimplementedasnumberofdifferentvariableswhichwouldmakemoresenseinmyopinion.MySQL5.6addsalotmoreoptimizerswitcheswhichyoucanplaywith:
01 | mysql[localhost]{msandbox}(test)> select * from var55 where variable_name= 'OPTIMIZER_SWITCH' \G |
02 | ***************************1.row*************************** |
03 | VARIABLE_NAME:OPTIMIZER_SWITCH |
04 | VARIABLE_VALUE:index_merge= on ,index_merge_union= on ,index_merge_sort_union= on ,index_merge_intersection= on ,engine_condition_pushdown= on |
05 | 1row in set (0.00sec) |
06 |
07 | mysql[localhost]{msandbox}(test)> select * from var56 where variable_name= 'OPTIMIZER_SWITCH' \G |
08 | ***************************1.row*************************** |
09 | VARIABLE_NAME:OPTIMIZER_SWITCH |
10 | VARIABLE_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 |
11 | 1row in set (0.00sec) |
相关文章推荐
- 红薯 MySQL 5.5 和 5.6 默认参数值的差异
- 红薯 MySQL 5.5 和 5.6 默认参数值的差异
- MySQL 5.5 和 5.6 默认参数值的差异
- MySQL 5.5 和 5.6 默认参数值的差异
- MySQL 5.5 和 5.6 默认参数值的差异
- MySQL 5.5 和 5.6 默认值差异
- ubuntu 12.04 升级 mysql5.5 到 mysql 5.6
- MySQL 5.5/5.6复制
- CentOS7安装配置LEMP(Nginx/PHP-FPM 5.6/MySQL 5.5)网站环境过程
- MySQL Study之--Percona server 5.5升级5.6
- MySQL5.5/5.6/5.7的安装脚本
- 在CentOS上把MySQL从5.5升级到5.6(转)
- MySQL5.6相比5.5的新特性之GTID
- Windows下PHP 5.6+Apache 2.4+MySQL 5.5安装与配置
- Mysql5.5升级到5.6
- 软件实习笔记三(Qt5.5连接MySQL5.6)
- CentOS:yum安装MySQL5.6并更改其默认路径
- (原创)Linux下MySQL 5.5/5.6的修改字符集编码为UTF8(彻底解决中文乱码问题)
- mysql5.5 mysql5.6 mysql5.7官方手册
- mysql5.6+版本主从设置(mysql5.5之后的主从设置跟5.5之前的设置有一些差距)