我正在使用MariaDB 10.2。我有一个约60M行的表。最初是我试图跑:
insert into signals select * from signals_tmp where signal_num = 21;
MariaDB冻结了。从那时起,我试图重启mysqld和我的笔记本电脑,所以我不知道它第一次冻结的确切状态。现在,当我尝试这样做时:
select count(*) from signals where signal_num = 20
它冻结了,所以我在MySQL中按 Ctrl + C 。然后我运行以下内容:
MariaDB [phd]> show open tables where In_use = 1;
+----------+---------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+---------+--------+-------------+
| phd | signals | 1 | 0 |
+----------+---------+--------+-------------+
1 row in set (0.00 sec)
MariaDB [phd]> show processlist;
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
| Id | User | Host | db | Command | Time | State
| Info | Progress |
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
| 1 | system user | | NULL | Daemon | NULL | InnoDB purge coordinator | NULL | 0.000 |
| 2 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 3 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 4 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 5 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 |
| 8 | root | localhost:50473 | phd | Killed | 402 | Sending data
| select count(*) from signals where signal_num = 20 | 0.000 |
| 10 | root | localhost:50477 | phd | Query | 0 | init
| show processlist | 0.000 |
| 11 | root | localhost:50489 | NULL | Query | 48 | Filling schema table | SHOW STATUS | 0.000
|
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
8 rows in set (0.00 sec)
当我尝试使用刷新表时,它在没有CPU使用情况下挂起(即看起来没有做任何事情?)。
[编辑]根据评论,这是统计结果。
MariaDB [(none)]> select distinct COMMENT from information_schema.statistics where TABLE_SCHEMA='phd' and table_schema='signals';
Empty set (0.00 sec)
知道我的数据库发生了什么事吗?
答案 0 :(得分:0)
可能你有一个需要关闭的开放交易。
BEGIN;
...
(program still running, but not COMMIT yet)
否则,SHOW PROCESSLIST
应该显示一些内容。
所以...寻找可能处于该状态的客户;杀了他们。