数据库
首页 > 数据库> > mysql – 查询分析显示“等待查询缓存锁定”,但query_cache_size为0

mysql – 查询分析显示“等待查询缓存锁定”,但query_cache_size为0

作者:互联网

我们有一个基于语句的复制服务器,它一直在经历减速,并且在事件期间,SHOW FULL PROCESSLIST显示复制查询停留在“等待查询缓存锁定”,这是令人惊讶的,因为服务器query_cache_size设置为0.
对有问题的查询进行概要分析会在每次更新表时显示此步骤.

即使query_cache_size为0,这是典型的在配置文件中查看更新吗?这真的只是检查查询缓存而不是等待获取真正锁定的查询吗?

解决方法:

该消息表示您尝试获取查询缓存互斥锁,即使query_cache_size为0(Note that akuzminsky mentioned that the MySQL for Oracle still allows this)您也需要将query_cache_type设置为0,因为MySQL文档说:

If the server is started with 07002 set to 0, it does not acquire the query cache mutex at all, which means that the query cache cannot be enabled at runtime and there is reduced overhead in query execution.

在MySQL 5.6中,query_cache_type默认为0.它是MySQL 5.0,5.15.5的1

无论MySQL版本如何,请确保my.cnf有这些

[mysqld]
query_cache_size = 0
query_cache_type = 0

你不需要重启mysql.只需登录mysql并运行以下命令:

mysql> SET GLOBAL query_cache_size = 0;
mysql> SET GLOBAL query_cache_type = 0;

试试看 !!!

标签:mysql,replication,query-cache
来源: https://codeday.me/bug/20190805/1592393.html