在我的一个MySQL数据库上创建一个简单的表需要花费很多时间:
mysql> CREATE TABLE blah (id BIGINT UNSIGNED NOT NULL PRIMARY KEY);
Query OK, 0 rows affected (16.58 sec)
机器很空闲:
01:21:26 PM CPU %user %nice %system %iowait %steal %idle
01:21:27 PM all 0.50 0.00 0.21 0.00 0.00 99.29
任何想法如何对此进行调查?
编辑:按照DTest的建议,这是执行配置文件:
mysql> SHOW PROFILE FOR QUERY 1;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000044 |
| checking permissions | 0.000024 |
| creating table | 8.668129 |
| After create | 0.000014 |
| query end | 0.000005 |
| freeing items | 0.000028 |
| logging slow query | 0.000004 |
| logging slow query | 0.000206 |
| cleaning up | 0.000006 |
+----------------------+----------+
@Phil具有大约16GB内存的物理机。
—
亚当·马坦
@Phil这是具有许多MySQL操作的生产服务器,因此磁盘不应处于空闲状态。
—
亚当·马坦