如果Mysql查询是什么意思:
SHOW PROCESSLIST;
Run Code Online (Sandbox Code Playgroud)
在State列中返回"发送数据"?
我想这意味着查询已经执行,MySQL正在向客户端发送"结果"数据,但我想知道为什么它花了这么多时间(长达一个小时).
谢谢.
我在与运行5.5的服务器相同的机器上的简单表上运行简单查询.从一个2000万行表中返回~7000行需要22秒.在分析时,大多数时间被多个"等待查询缓存锁定"占用.什么是"等待查询缓存锁定",为什么这个查询需要这么长时间?这与我设置服务器的方式有关吗?
这里是配置文件(注意,该操作的时间实际上是从陈述如下行这里):
mysql> show profile for query 4;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000015 |
| Waiting for query cache lock | 0.000003 |
| checking query cache for query | 0.000045 |
| checking permissions | 0.000006 |
| Opening tables | 0.000027 |
| System lock | 0.000007 |
| Waiting for query cache lock | 0.000032 |
| init | 0.000018 |
| optimizing | 0.000008 |
| statistics | …Run Code Online (Sandbox Code Playgroud) We have noticed some inconsistencies in our MySQL performance for query times that we feel cannot be explained by just server load. Some queries seem to be much efficient than others, despite having a similar setup.
Edit: Since opening this question, our database crashed (for unknown reasons at this moment, RDS teams are investigating), and after a reboot the issue is no longer reproducible and the queries are the same speed. I still would like to know what was wrong …