语法:
元素
用途
关键注意事项
STMT_CACHE_HITS hits
指定语句完全插入到
SQL 语句高速缓存之
前,对它的命中(引
用)数。将 hits 设
置为 1 或更大可防
止特定查询进入高速
缓存
仅可增加或重设STMT_CACHE_HITS
的值。新值显示在 onstat -g ssc
输出的 #hits 字段中。
如果 hits
=
0 ,数据库服务器在高速缓存中
插入所有符合条件的语句及其内
存结构。如果 hits > 0 并且 SQL
语句的已执行次数小于
STMT_CACHE_HITS ,
那么数据库服
务器会在高速缓存插入 key-only
条目。
在已将语句执行了指定命中
次数之后,
它在高速缓存中插入符
合条件的语句。ONCONFIG 参数:
STMT_CACHE_HITS
STMT_CACHE_NOLIMIT value
控制语句是否插入
SQL 语句高速缓存
如果 value = 0,那么数据库服务
器在高速缓存中插入语句。如果
value = 1,数据库服务器总是在
高速缓存中插入语句。
如果没有共
享任何查询,那么关闭
GBase 8s 管理员参考
南大通用数据技术股份有限公司 - 376 -
元素
用途
关键注意事项
STMT_CACHE_NOLIMIT 可防止数据
库服务器为高速缓存分配大量内
存。ONCONFIG 参数:
STMT_CACHE_NOLIMIT
SQL 语句高速缓存示例
以下是用于更改 SQL 语句高速缓存(SSC)设置的 onmode -W 命令的示例。更改只对当
前数据库会话生效,且不能更改 ONCONFIG 值。重新启动数据库服务器时,它使用缺省
的 SSC 设置(如果未在 ONCONFIG 文件中指定)或 ONCONFIG 设置。要做出永久更
改,请设置相应的配置参数。
onmode -W STMT_CACHE_HITS 2 # number of hits before statement is
# inserted into SSC
onmode -W STMT_CACHE_NOLIMIT 1 # always insert statements into
# the cache
该命令有等同的 SQL 管理 API 函数。