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第一种类 ...
随机推荐
- C语言实例解析精粹学习笔记——34(用“结构”统计学生成绩)
实例34: 设学生信息包括学号.姓名和五门功课的成绩,要求编写输入输出学生信息的函数.在输入学生信息后,以学生成绩的总分从高到低顺序输出学生信息. 思路: 程序引入一个结构数组依次存储输入的学生信息, ...
- Android面试收集录 文件存储
1.请描述Android SDK支持哪些文件存储技术? 使用SharePreferences保存key-value类型的数据 流文件存储(openFileOutput+openFileInput或Fi ...
- 4-oracle11g安装
1.导入安装包,解压 [root@ocp Desktop]# unzip p10404530_112030_Linux-x86-64_1of7.zip [root@ocp Desktop]# unzi ...
- golang select 退出结束goroutine
开启了多个协程 其中一个协程满足条件后终止select, 原以为其他的协程会在后台系统中继续悄悄运行 直到主进程关闭而关闭 . 做一实验发现select 监听退出 会关闭所有监听的goroutine ...
- 阿牛的EOF牛肉串(递推)
阿牛的EOF牛肉串 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Sub ...
- 【java并发编程实战】第五章:基础构建模块
1.同步容器类 它们是线程安全的 1.1 vector和hashtable. 和Collections.synchronizeXxx()一样.实现方式就是在每个方法里面加入synchronize代码块 ...
- 《python机器学习—预测分析核心算法》:理解数据
参见原书2.1-2.2节 新数据集就像一个包装好的礼物,它充满了承诺和希望! 但是直到你打开前,它都保持神秘! 一.基础问题的架构.术语,机器学习数据集的特性 通常,行代表实例,列代表属性特征 属性, ...
- 七天入门C++
- [推荐]spring cloud 详解
http://blog.csdn.net/column/details/15197.html
- 九度OJ--1163(C++)
#include <iostream>#include <vector> using namespace std; int main() { int n; while(cin& ...