MySQL中经常遇到事务中的SQL正在执行或执行完成后未提交,如何找出对应的未提SQL?
查看事务中正在执行的SQL方式有多种,例如
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> select sleep(20),now() ,id from test1;
mysql> select id ,info from information_schema.processlist where info is not null;
+----+------------------------------------------------------------------------------+
| id | info |
+----+------------------------------------------------------------------------------+
| 36 | select sleep(20),now() ,id from test1 |
| 37 | select id ,info from information_schema.processlist where info is not null |
+----+------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> select sleep(20),now() ,id from test1;
mysql> select a.id,a.info, b.thread_id, c.sql_text from information_schema.processlist a, performance_schema.threads b, performance_schema.events_statements_current c where a.id=b.processlist_id and b.thread_id = c.thread_id\G
(责任编辑:知识)
华电国际(600027.SH)公布消息:拟购买蒙东能源45.15%股权及福源热电36.86%股权
宏柏新材(605366.SH)实际控制人林庆松拟增持500万元
美的华凌 610L 冰箱低至 1430 元:京东家电 11.11 大促加码
亚太卫星(01045.HK)年度纯利减少36.1% 每股盈利24.88港仙
京东补来天猫补:爱优腾B / WPS / 网盘 / 音乐 / QQ 会员 11.11 狂促加码