1. 程式人生 > >MySQL的響應時間變慢

MySQL的響應時間變慢

# 沒有用到查詢快取
16:33:52 127.0.0.1:3306 information_schema>show profile for query 8;
+----------------------+----------+
| Status               | Duration |
+----------------------+----------+
| starting             | 0.000014 |
| checking permissions | 0.000002 |
| Opening tables       | 0.000007 |
| System lock          | 0.000004 |
| init                 | 0.000006 |
| optimizing           | 0.000001 |
| statistics           | 0.000007 |
| preparing            | 0.000004 |
| executing            | 0.000001 |
| Sending data         | 0.000005 |
| end                  | 0.000001 |
| query end            | 0.000001 |
| closing tables       | 0.000003 |
| freeing items        | 0.000013 |
| logging slow query   | 0.000001 |
| cleaning up          | 0.000002 |
+----------------------+----------+
16 rows in set (0.00 sec)

# 用到了查詢快取
16:36:15 127.0.0.1:3306 information_schema>show profile for
query 1; +--------------------------------+----------+ | Status | Duration | +--------------------------------+----------+ | starting | 0.000015 | | Waiting for query cache lock | 0.000002 | | Waiting on query cache mutex | 0.000002 | | checking query cache for query | 0.000059 | | checking permissions | 0.000006 | | Opening tables | 0.000023 | | System
lock | 0.000013 | | init | 0.000018 | | optimizing | 0.000004 | | statistics | 0.000022 | | preparing | 0.000010 | | executing | 0.000003 | | Sending data | 0.000011 | | end | 0.000003 | | query end | 0.000002 | | closing tables | 0.000007 | | freeing items | 0.000019 | | logging slow query | 0.000002 | | cleaning up | 0.000003 | +--------------------------------+----------+ 19 rows in set (0.00 sec)