相关参数

read_buffer_size

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_read_buffer_size

If you do many sequential scans, you might want to increase this value, which defaults to 131072.

The value of this variable should be a multiple of 4KB. If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.

This option is also used in the following context for all storage engines:
For caching the indexes in a temporary file (not a temporary table), when sorting rows for ORDER BY.
For bulk insert into partitions.
For caching results of nested queries.
read_buffer_size is also used in one other storage engine-specific way:

to determine the memory block size for MEMORY tables.

For more information about memory use during different operations, see Section 8.12.3.1, “How MySQL Uses Memory”.

read_rnd_buffer_size

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_read_rnd_buffer_size

This variable is used for reads from MyISAM tables, and, for any storage engine, for Multi-Range Read optimization.

When reading rows from a MyISAM table in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks. See Section 8.2.1.16, “ORDER BY Optimization”. Setting the variable to a large value can improve ORDER BY performance by a lot. However, this is a buffer allocated for each client, so you should not set the global variable to a large value. Instead, change the session variable only from within those clients that need to run large queries.

Multi-Range Read:减少磁盘的随机访问,并且将随机访问转化为较为顺序的数据访问,详细说明请参见

https://www.cnblogs.com/olinux/p/5146868.html

sort_buffer_size

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size

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 optimizer tries to work out how much space is needed but can allocate more, up to the limit. 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 B.4.3.5, “Where MySQL Stores Temporary Files”.

其他参考

https://www.cnblogs.com/wy123/p/7744171.html

配置示例

64G物理内存,sort_buffer_size=4M

| Sort_merge_passes                             | 11                                                 |
| Sort_range | 55963361 |
| Sort_rows | 1347711564 |
| Sort_scan | 83848520

mysql配置文件主要参数

https://www.jb51.net/article/48082.htm

binlog_cache_size

https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_cache_size

写入binlog事务的缓冲区,线程级参数。

The size of the memory buffer to hold changes to the binary log during a transaction. When binary logging is enabled on the server (with the log_bin system variable set to ON), a binary log cache is allocated for each client if the server supports any transactional storage engines. If the data for the transaction exceeds the space in the memory buffer, the excess data is stored in a temporary file. When binary log encryption is active on the server, the memory buffer is not encrypted, but (from MySQL 8.0.17) any temporary file used to hold the binary log cache is encrypted. After each transaction is committed, the binary log cache is reset by clearing the memory buffer and truncating the temporary file if used.

If you often use large transactions, you can increase this cache size to get better performance by reducing or eliminating the need to write to temporary files. The Binlog_cache_use and Binlog_cache_disk_use status variables can be useful for tuning the size of this variable. See Section 5.4.4, “The Binary Log”.

配置示例一:

binlog_cache_size 32K,物理内存64G

mysql> show global status like 'Binlog_cache%';
+-----------------------+-----------+
| Variable_name | Value |
+-----------------------+-----------+
| Binlog_cache_disk_use | 5169527 |
| Binlog_cache_use | 897476315 |
+-----------------------+-----------+
2 rows in set (0.00 sec) mysql> show global status like 'Binlog_cache%';
+-----------------------+-----------+
| Variable_name | Value |
+-----------------------+-----------+
| Binlog_cache_disk_use | 5169534 |
| Binlog_cache_use | 897476897 |
+-----------------------+-----------+
2 rows in set (0.00 sec) mysql> show global status like 'Binlog_cache%';
+-----------------------+-----------+
| Variable_name | Value |
+-----------------------+-----------+
| Binlog_cache_disk_use | 5169536 |
| Binlog_cache_use | 897477059 |
+-----------------------+-----------+
mysql> show global status like 'Sort%';
+-------------------+-------------+
| Variable_name | Value |
+-------------------+-------------+
| Sort_merge_passes | 6732 |
| Sort_range | 521537793 |
| Sort_rows | 11590846064 |
| Sort_scan | 3845091301 |
+-------------------+-------------+
4 rows in set (0.00 sec) mysql>
mysql> show global status like 'Sort%';
+-------------------+-------------+
| Variable_name | Value |
+-------------------+-------------+
| Sort_merge_passes | 6732 |
| Sort_range | 521537839 |
| Sort_rows | 11590846115 |
| Sort_scan | 3845091308 |
+-------------------+-------------+
4 rows in set (0.01 sec) mysql> show global status like 'Sort%';
+-------------------+-------------+
| Variable_name | Value |
+-------------------+-------------+
| Sort_merge_passes | 6732 |
| Sort_range | 521537992 |
| Sort_rows | 11590846217 |
| Sort_scan | 3845091328 |
+-------------------+-------------+
4 rows in set (0.01 sec)

my43_mysql内存相关概念的更多相关文章

  1. 转 Linux内存管理原理

    Linux内存管理原理 在用户态,内核态逻辑地址专指下文说的线性偏移前的地址Linux内核虚拟3.伙伴算法和slab分配器 16个页面RAM因为最大连续内存大小为16个页面 页面最多16个页面,所以1 ...

  2. JVM学习——垃圾回收GC(学习过程)

    JVM学习-垃圾回收(GC) 2020年02月19日06:03:56,开始学习垃圾回收,学习资料来源(张龙老师的JVM课程) JVM内存数据区域知识复习 学习垃圾回收之前,要对JVM内部的内存区域有详 ...

  3. linux内存管理

    一.Linux 进程在内存中的数据结构 一个可执行程序在存储(没有调入内存)时分为代码段,数据段,未初始化数据段三部分:    1) 代码段:存放CPU执行的机器指令.通常代码区是共享的,即其它执行程 ...

  4. C++11 并发指南七(C++11 内存模型一:介绍)

    第六章主要介绍了 C++11 中的原子类型及其相关的API,原子类型的大多数 API 都需要程序员提供一个 std::memory_order(可译为内存序,访存顺序) 的枚举类型值作为参数,比如:a ...

  5. 人人都是 DBA(IV)SQL Server 内存管理

    SQL Server 的内存管理是一个庞大的主题,涉及特别多的概念和技术,例如常见的 Plan Cache.Buffer Pool.Memory Clerks 等.本文仅是管中窥豹,描述常见的内存管理 ...

  6. Android开发学习总结——Android开发的一些相关概念

    一.什么是3G.4G 1995年问世的第一代模拟制式手机(1G)只能进行语音通话. 1996到1997年出现的第二代GSM.CDMA等数字制式手机(2G)便增加了接收数据的功能 Ÿ 3G指的是第三代移 ...

  7. iOS性能优化之内存管理:Analyze、Leaks、Allocations的使用和案例代码

    最近接了个小任务,和公司的iOS小伙伴们分享下instruments的具体使用,于是有了这篇博客...性能优化是一个很大的话题,这里讨论的主要是内存泄露部分. 一. 一些相关概念 很多人应该比较了解这 ...

  8. OC的内存管理

    摘自:http://blog.csdn.net/hahahacff/article/details/39839571 OC内存管理 一.基本原理 (一)为什么要进行内存管理. 由于移动设备的内存极其有 ...

  9. linux设备驱动归纳总结(四):1.进程管理的相关概念【转】

    本文转载自;http://blog.chinaunix.net/uid-25014876-id-64866.html linux设备驱动归纳总结(四):1.进程管理的相关概念 xxxxxxxxxxxx ...

随机推荐

  1. [jmeter]Jmeter+ant实现接口自动化

    1.安装jmeter 和ant &环境变量配置百度去~ 2.jmeter和ant关联 &将JMeter所在目录下extras子目录里的ant-JMeter-1.1.1.jar复制到an ...

  2. HttpClient用法--这一篇全了解(内含例子)

    HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性,它不仅使客户端发送Http请求变得容易,而且也方便开发人员测试接口(基于Http协议的),提高了开发的效率,也 ...

  3. [第二章]c++学习笔记4(复制构造函数)

    性质 (1)只有一个参数,即被同类对象的引用. 注 起作用的三种情况 注 常量引用参数

  4. Typora常用操作

    Typora常用操作 目录 Typora常用操作 1. 标题 2.子标题 3. 区块 4.代码 5. 表格 6. 超链接 7.单选框 8.数学公式 9.流程图 10.生成目录 11.字体设置 12. ...

  5. [hdu6973]Bookshop

    将询问拆成$x$​到$lca$​和$lca$​($lca$​靠近$y$​的儿子)到$y$​​两部分,分别处理(后者以前者的答案为基础) 两者是类似地,不妨仅考虑前者:用树剖将该询问拆成dfs序上若干个 ...

  6. [noi795]保镖

    容易证明,最终方案一定是某一个排列无限循环,那么就要满足$\sum ai<=max(bi+ai)$,对所有数按照ai+bi排序后,枚举最大值,用权值线段树维护之前的ai最少要选几个 1 #inc ...

  7. 如何删除一个win10的服务

    使用场景: 之前电脑玩腾讯qq微端游戏,后来卸载残留服务一直在后台占用系统资源.那么如何关闭这个服务呢. 1.首先 管理员运行--cmd.exe 2.打开任务管理器,找到服务名称,如果服务开启可以关闭 ...

  8. 关于Jmeter线程组的设置,看这一篇就够了

    一.事件背景 个人感觉自己做性能测试,可以说是轻车熟路了,而且工作多年一直都是这一套测试思路及体系,从未质疑过自己,也许是狮子座的迷之自信吧! 也就在上周让我对自己的测试方法及体系产生了质疑! 为什么 ...

  9. Redis线程模型的前世今生

    一.概述 众所周知,Redis是一个高性能的数据存储框架,在高并发的系统设计中,Redis也是一个比较关键的组件,是我们提升系统性能的一大利器.深入去理解Redis高性能的原理显得越发重要,当然Red ...

  10. Codeforces 650D - Zip-line(树状数组)

    Codeforces 题目传送门 & 洛谷题目传送门 我怕不是个 nt--一开始忽略了"询问独立"这个条件--然后就一直在想有什么办法维护全局 LIS--心态爆炸 首先离散 ...