一起学习网 一起学习网

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

本站中文解释

– 参数名:stored_program_cache
– 取值范围:字符串”256K”至”1M”,可以增至”4M”
– 默认取值:256K
– 用途:该参数用于控制MySQL可用于存储计划缓存的大小。

设置方法:

1. 在MySQL客户端中连接到MySQL数据库服务器
2. 使用如下命令设置参数值:SET GLOBAL stored_program_cache=256K;
3. 保存设置(如果你有权限):SAVE MYSQL VARIABLES TO FILE;

官方英文解释

stored_program_cache

Command-Line Format--stored-program-cache=#
System Variablestored_program_cache
ScopeGlobal
DynamicYes
TypeInteger
Default Value256
Minimum Value16
Maximum Value524288

Sets a soft upper limit for the number of cached stored
routines per connection. The value of this variable is
specified in terms of the number of stored routines held in
each of the two caches maintained by the MySQL Server for,
respectively, stored procedures and stored functions.

Whenever a stored routine is executed this cache size is
checked before the first or top-level statement in the routine
is parsed; if the number of routines of the same type (stored
procedures or stored functions according to which is being
executed) exceeds the limit specified by this variable, the
corresponding cache is flushed and memory previously allocated
for cached objects is freed. This allows the cache to be
flushed safely, even when there are dependencies between
stored routines.