您的位置
主页 > 网站技术 > 数据库 > » 正文

MySQL高速缓存启动方法及参数详解(query_cache_size)

来源: 锦尚中国 点击:

MySQL query cache从4.1版本开始提供了,不过值今天本人才对其进行研究。默认配置下,MySQL的该功能是没有启动的,可能你通过show variables like ‘%query_cache%';会发现其变量have_query_cache的值是yes,MYSQL初学者很容易以为这个参数为YES就代表开启了查询缓存,实际上是不对的,该参数表示当前版本的MYSQL是否支持Query Cache,实际上是否开启查询缓存是看另外一个参数的值:query_cache_size ,该值为0,表示禁用query cache,而默认配置正是配置为0。

配置方法:

在MYSQL的配置文件my.ini或my.cnf中找到如下内容:

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# “Qcache_lowmem_prunes” status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.

query_cache_size=0




首页  - 关于站长圈  - 广告服务  - 联系我们  - 关于站长圈  - 网站地图  - 版权声明