-
SELECT b.processlist_id, c.db, a.sql_text, c.command, c.time, c.state
-
FROM performance_schema.events_statements_current a JOIN performance_schema.threads b USING(thread_id)
-
JOIN information_schema.processlist c ON b.processlist_id = c.id
-
WHERE a.sql_text NOT LIKE '%performance%';
結(jié)果:
-
+----------------+------+--------------------------------------------+---------+------+---------------------------------+
-
| processlist_id | db | sql_text | command | time | state |
-
+----------------+------+--------------------------------------------+---------+------+---------------------------------+
-
| 585 | test | UPDATE t SET name='fasdfsad' | Sleep | 243 | |
-
| 586 | test | ALTER TABLE t CHANGE name name varchar(32) | Query | 238 | Waiting for table metadata lock |
-
+----------------+------+--------------------------------------------+---------+------+---------------------------------+
-
2 rows in set (0.01 sec)
也可以很容易定位到執(zhí)行的內(nèi)容是做了一個(gè)update操作未提交。
作者微信公眾號(hào)(持續(xù)更新)