myisam_sort_buffer_size vs sort_buffer_size
Q:
I am MySQL on server with 6GB RAM. I need to know what is the difference between myisam_sort_buffer_size and sort_buffer_size?
I have following size set to them:
myisam_sort_buffer_size = 8M
sort_buffer_size = 256M
Please also mention if these values are fine or need adjustments?
Thanks
A:
sort_buffer_size:
MySQL documentation:
Each session that needs to do a sort allocates a buffer of this size. sort_buffer_size is not specific to any storage engine and applies in a general manner for optimization.
Your sort_buffer_size value seems extremely high. The default is 2M. I'd recommend going no larger than that since there is a performance penalty for going higher. Some people recommend smaller values such as 256kB. One thing to remember is this is per-client-session, it's not a global value. Large values will add up fast.
myisam_sort_buffer_size:
MySQL documentation:
The size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE.
Your myisam_sort_buffer_size seems fine. This won't be relevant unless you are rebuilding indexes using ALTER TABLE or REPAIR TABLE etc.
Each session that needs to do a sort allocates a buffer of this size. sort_buffer_size
is not specific to any storage engine and applies in a general manner for optimization. See Section 8.3.1.11, “ORDER BY
Optimization”, for example.
If you see many Sort_merge_passes
per second in SHOW GLOBAL STATUS
output, you can consider increasing the sort_buffer_size
value to speed up ORDER BY
or GROUP BY
operations that cannot be improved with query optimization or improved indexing. The entire buffer is allocated even if it is not all needed, so setting it larger than required globally will slow down most queries that sort. It is best to increase it as a session setting, and only for the sessions that need a larger size. On Linux, there are thresholds of 256KB and 2MB where larger values may significantly slow down memory allocation, so you should consider staying below one of those values. Experiment to find the best value for your workload. See Section C.5.4.4, “Where MySQL Stores Temporary Files”.
The maximum permissible setting for sort_buffer_size
is 4GB–1. As of MySQL 5.1.23, larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB–1 with a warning).
The size of the buffer that is allocated when sorting MyISAM
indexes during a REPAIR TABLE
or when creating indexes with CREATE INDEX
or ALTER TABLE
.
The maximum permissible setting for myisam_sort_buffer_size
is 4GB–1. As of MySQL 5.1.23, larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB–1 with a warning).
The maximum size of the temporary file that MySQL is permitted to use while re-creating a MyISAM
index (during REPAIR TABLE
, ALTER TABLE
, or LOAD DATA INFILE
). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. The value is given in bytes.
The default value is 2GB. If MyISAM
index files exceed this size and disk space is available, increasing the value may help performance. The space must be available in the file system containing the directory where the original index file is located.
参考:
http://stackoverflow.com/questions/7871027/myisam-sort-buffer-size-vs-sort-buffer-size
https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_myisam_max_sort_file_size
myisam_sort_buffer_size vs sort_buffer_size的更多相关文章
- 8.2.1.15 ORDER BY Optimization ORDER BY 优化
8.2.1.15 ORDER BY Optimization ORDER BY 优化 在一些情况下, MySQL 可以使用一个索引来满足一个ORDER BY 子句不需要做额外的排序 index 可以用 ...
- MySQL5.6 windows7下安装及基本操作
图形界面安装MySQL5.6关于图形界面的安装,网上相关相关资料比较多,此处省略安装过程.安装过程中选择安装路径.所需组件及root账号密码.1.目前针对不同用户,MySQL提供了2个不同的版本:My ...
- MySQL优化二(连接优化和缓存优化)
body { font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 1.6; padding-top: 10 ...
- mysql 参数:[read_buffer_size] [sort_buffer_size] [read_rnd_buffer_size] [tmp_table_size]---图解
http://imysql.cn/2008_09_27_deep_into_mysql_sort_buffer http://my.oschina.net/realfighter/blog/36442 ...
- sort_buffer_size:
sort_buffer_size: 每个session 必须执行一个排序 分配一个 这个大小的buffer. sort_buffer_size 不特定的对于任何存储引擎适用于一般的优化方式. sort ...
- MySQL中的sort_buffer_size参数大小的设置问题
看到sort_buffer_size这个参数(connect级别的参数,MySQL5.7,默认值是1048576字节,也就是1MB)的默认值这么小,想着是不是可以调大一点,反正内存动不动几十个GB的, ...
- Sort_Buffer_Size 设置对服务器性能的影响
基础知识: 1. Sort_Buffer_Size 是一个connection级参数,在每个connection第一次需要使用这个buffer的时候,一次性分配设置的内存.2. Sort_Buffer ...
- More on understanding sort_buffer_size
There have been a few posts by Sheeri and Baron today on the MySQL sort_buffer_size variable. I want ...
- sort_buffer_size, Sort_merge_passes关系
对于事务性工作负载是通常最快这个大小设置为32K,并且也是允许的最小尺寸.您应该谨慎使用它设置为较大的值,因为这可以很容易地降低性能. 如果所有的数据进行排序不适合在指定缓冲区大小的MySQL第一种类 ...
随机推荐
- 基于STM32F103的Max30100心率、血氧检测代码(转载)
MAX30100是能够读取心率.血氧的传感器,通信方式是通过IIC进行通信.其工作原理是通过红外led灯照射,能够得到心率的ADC值. MAX30100的寄存器可以分为五类,状态寄存器.F ...
- Python3爬虫(七) 解析库的使用之pyquery
Infi-chu: http://www.cnblogs.com/Infi-chu/ pyquery专门针对CSS和jQuery的操作处理 1.初始化字符串初始化 from pyquery impor ...
- MySQL基础复习
三范式定义 1NF:每个数据项都是最小单元,不可分割,其实就是确定行列之后只能对应一个数据. 2NF:每一个非主属性完全依赖于候选码(属性组的值能唯一的标识一个元组,但是其子集不可以). 3NF: ...
- 521. [NOIP2010] 引水入城 cogs
521. [NOIP2010] 引水入城 ★★★ 输入文件:flow.in 输出文件:flow.out 简单对比时间限制:1 s 内存限制:128 MB 在一个遥远的国度,一侧是风景秀 ...
- 从C到C++ (2)
从C到C++ (2) 一. C++中增加了作用域标示符 :: 1. 用于对局部变量同名的全局变量进行访问. 2. 用于表示类成员. 二. new.delete运算符 1. ...
- 自定义T4模板去掉实体对象中的下划线
在EF Power Tool 默认使用的T4模板中,如果数据库表有下划线,那么生成的实体也有下划线,但是我们实际使用的过程中,是不希望有下划线的,要解决这个问题,可以自定义这个T4模板 ...
- 【APUE】Chapter15 Interprocess Communication
15.1 Introduction 这部分太多概念我不了解.只看懂了最后一段,进程间通信(IPC)内容被组织成了三个部分: (1)classical IPC : pipes, FIFOs, messa ...
- 虚拟现实-VR-UE4-创建一个自定义的角色 Character
我学习的资料使用的是老版本的ue4 新版本有好多都是不一样的,好多东西需要自己来摸索, 比如,在老板版本中,默认创建一个GameMode 是回自动创建构造函数发的,而新版本,是没有的,需要自己手动填写 ...
- 【java并发编程实战】第六章:线程池
1.线程池 众所周知创建大量线程时代价是非常大的: - 线程的生命周期开销非常大:创建需要时间,导致延迟处理请求,jvm需要分配空间. - 资源消耗:线程需要占用空间,如果线程数大于可用的处理器数量, ...
- Eureka搭建
Eureka搭建 一.Eureka基本框架搭建 pom.xml文件配置:主要是引入Eureka所依赖的jar包 <?xml version="1.0" encoding=&q ...