MySQL Variables query_alloc_block_size 数据库 参数变量解释及正确配置使用

本站中文解释

query_alloc_block_size参数用于控制MySQL查询缓存块的大小,即一次从硬盘中读取数据时,读取的数据最大大小。其默认值是 8K。

该参数会影响MySQL查询缓存的效率,如果值太小,则会导致查询缓存被多次重度命中,只能获取少量数据;如果值太大,则会降低查询缓存的命中率,导致查询缓存的利用率降低。

因此,在设置query_alloc_block_size参数时,应该根据MySQL的查询缓存大小和运行的硬件环境来决定,一般可以设置的值范围是 2K ~ 32K。

可以使用以下语句对query_alloc_block_size参数进行设置:

SET GLOBAL query_alloc_block_size = 16K;

官方英文解释

query_alloc_block_size

Command-Line Format --query-alloc-block-size=#
System Variable query_alloc_block_size
Scope Global, Session
Dynamic Yes
Type Integer
Default Value 8192
Minimum Value 1024
Maximum Value 4294966272
Unit bytes
Block Size 1024

The allocation size in bytes of memory blocks that are
allocated for objects created during statement parsing and
execution. If you have problems with memory fragmentation, it
might help to increase this parameter.

The block size for the byte number is 1024. A value that is
not an exact multiple of the block size is rounded down to the
next lower multiple of the block size by MySQL Server before
storing the value for the system variable. The parser allows
values up to the maximum unsigned integer value for the
platform (4294967295 or 232−1
for a 32-bit system, 18446744073709551615 or
264−1 for a 64-bit system)
but the actual maximum is a block size lower.


数据运维技术 » MySQL Variables query_alloc_block_size 数据库 参数变量解释及正确配置使用