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

本站中文解释

query_prealloc_size 变量是MySQL提供的一个服务器系统变量,用于控制查询缓冲区的大小。它确定了MySQL服务器在每次打开查询缓冲区时分配的大小。这个参数的默认值为8KB,如果查询有大量的条件过滤,或者,查询中需要排序,可以修改这个参数为一个更高的值,比如16KB或者32KB,以便提升查询效率。

要更改MySQL中的参数,可以使用`SET GLOBAL `或`SET SESSION`命令,具体格式如下:
`SET GLOBAL query_prealloc_size = 需要设定的值`

官方英文解释

query_prealloc_size

Command-Line Format --query-prealloc-size=#
System Variable query_prealloc_size
Scope Global, Session
Dynamic Yes
Type Integer
Default Value 8192
Minimum Value 8192
Maximum Value (64-bit platforms) 18446744073709550592
Maximum Value (32-bit platforms) 4294966272
Unit bytes
Block Size 1024

The size in bytes of the persistent buffer used for statement
parsing and execution. This buffer is not freed between
statements. If you are running complex queries, a larger
query_prealloc_size value
might be helpful in improving performance, because it can
reduce the need for the server to perform memory allocation
during query execution operations. You should be aware that
doing this does not necessarily eliminate allocation
completely; the server may still allocate memory in some
situations, such as for operations relating to transactions,
or to stored programs.

The block size 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_prealloc_size 数据库 参数变量解释及正确配置使用