MySQL Variables read_buffer_size 数据库 参数变量解释及正确配置使用
本站中文解释
read_buffer_size参数用于控制每次从MySQL服务器读取数据时使用的缓冲区大小,单位为字节,默认值为 1MB。因此,如果要设置read_buffer_size参数,则需要在MySQL服务器上编辑my.cnf文件,在[mysqld]节点下添加以下行:
read_buffer_size=n
其中,n为指定的参数值(单位为字节)。
在修改参数后,需要重新启动MySQL服务器才能生效。
官方英文解释
read_buffer_size
Command-Line Format | --read-buffer-size=# |
---|---|
System Variable | read_buffer_size |
Scope | Global, Session |
Dynamic | Yes |
Type | Integer |
Default Value | 131072 |
Minimum Value | 8192 |
Maximum Value | 2147479552 |
Unit | bytes |
Block Size | 4096 |
Each thread that does a sequential scan for a
MyISAM
table allocates a buffer of this
size (in bytes) for each table it scans. 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 is 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 forORDER
.
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.4.1, “How MySQL Uses Memory”.