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

本站中文解释

transaction_prealloc_size参数指定了每个事务开始时MySQL服务器中分配给该事务语句的事务缓存空间的大小。这个参数应该根据MySQL服务器的数据库业务类型和量来设置,默认为8192字节。

要改变这个参数的值,可以使用以下命令:

SET GLOBAL transaction_prealloc_size = value;

value可以是整数、字符串或者NULL,以字节为单位。将其设置为0则可取消预先分配空间,而将其设置为NULL则为每个事务分配默认值。

官方英文解释

transaction_prealloc_size

Command-Line Format --transaction-prealloc-size=#
System Variable transaction_prealloc_size
Scope Global, Session
Dynamic Yes
Type Integer
Default Value 4096
Minimum Value 1024
Maximum Value 131072
Unit bytes
Block Size 1024

There is a per-transaction memory pool from which various
transaction-related allocations take memory. The initial size
of the pool in bytes is
transaction_prealloc_size.
For every allocation that cannot be satisfied from the pool
because it has insufficient memory available, the pool is
increased by
transaction_alloc_block_size
bytes. When the transaction ends, the pool is truncated to
transaction_prealloc_size
bytes.

By making
transaction_prealloc_size
sufficiently large to contain all statements within a single
transaction, you can avoid many malloc()
calls.


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