结论: blocking_query 是当前堵塞其他会话正在运行的SQL.而不是原始堵塞SQL
2016-11-29 13:17
267 查看
查看当前session线程号 mysql> select connection_id(); +-----------------+ | connection_id() | +-----------------+ | 28 | +-----------------+ 1 row in set (0.02 sec) Session 1: Vsftp:/root# mysql -uroot -p1234567 -e " show processlist" Warning: Using a password on the command line interface can be insecure. +----+------+-----------+------+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+------+---------+------+-------+------------------+ | 17 | root | localhost | zjzc | Sleep | 0 | | NULL | mysql 进程1737 root 1737 979 0 13:02 pts/1 00:00:00 mysql -uroot -px xxxxx mysql> start transaction; Query OK, 0 rows affected (0.00 sec) mysql> delete from test where id=1; Query OK, 1 row affected (0.00 sec) Session 2: | 28 | root | localhost | zjzc | Sleep | 2 | | NULL 查看堵塞: mysql[192.168.11.187] blocking_thread[17] blocking_query[] blocking waiting_thread[28]'s delete from test where id=1 mysql> SELECT -> r.trx_id waiting_trx_id, -> r.trx_mysql_thread_id waiting_thread, -> r.trx_query waiting_query, -> b.trx_id blocking_trx_id, -> b.trx_mysql_thread_id blocking_thread, -> b.trx_query blocking_query -> FROM -> information_schema.innodb_lock_waits w -> INNER JOIN -> information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id -> INNER JOIN -> information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id; +----------------+----------------+-----------------------------+-----------------+-----------------+----------------+ | waiting_trx_id | waiting_thread | waiting_query | blocking_trx_id | blocking_thread | blocking_query | +----------------+----------------+-----------------------------+-----------------+-----------------+----------------+ | 112076626 | 28 | delete from test where id=1 | 112076625 | 17 | NULL | +----------------+----------------+-----------------------------+-----------------+-----------------+----------------+ 1 row in set (0.00 sec) Session 1:运行 mysql> select * from ClientActionTrack20151125 mysql[192.168.11.187] blocking_thread[17] blocking_query[select * from ClientActionTrack20151125] blocking waiting_thread[28]'s delete from test where id=1 mysql> SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_thread, b.trx_query blocking_query FROM information_schema.innodb_lock_waits w INNER JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id INNER JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id; +----------------+----------------+-----------------------------+-----------------+-----------------+-----------------------------------------+ | waiting_trx_id | waiting_thread | waiting_query | blocking_trx_id | blocking_thread | blocking_query | +----------------+----------------+-----------------------------+-----------------+-----------------+-----------------------------------------+ | 112076626 | 28 | delete from test where id=1 | 112076625 | 17 | select * from ClientActionTrack20151125 | +----------------+----------------+-----------------------------+-----------------+-----------------+-----------------------------------------+ 1 row in set (0.39 sec) 结论: blocking_query 是当前堵塞其他会话正在运行的SQL.而不是原始堵塞SQL
相关文章推荐
- 结论: blocking_query 是当前堵塞其他会话正在运行的SQL.而不是原始堵塞SQL
- 不允许启动新事务,因为有其他线程正在该会话中运行(ef并发错误处理之一)
- 不允许启动新事务,因为有其他线程正在该会话中运行。
- 探讨:MySQL中如何查询当前正在运行的SQL语句
- SqlServer: 查询当前正在运行的SQL
- 如何使PC上运行的程序不能退出,并且用户只能使用当前正在运行的程序。不能使用PC上的其他程序
- entity异常 不允许启动新事务,因为有其他线程正在该会话中运行。
- 查看当前正在运行的SQL语句的统计信息
- 使用v$sql_monitor视图查看当前正在运行的SQL语句的统计信息
- EF 不允许启动新事务,因为有其他线程正在该会话中运行。
- Sqlserver 2005+:【当前】【正在运行】的【进程会话的请求信息】
- 探讨:MySQL中如何查询当前正在运行的SQL语句
- com.microsoft.sqlserver.jdbc.SQLServerException: 此查询使用的不是 ANSI 外部联接运算符("*=" 或 "=*")。若要不进行修改即运行此查询,请使用存储过程 sp_dbcmptlevel 将当前数据库的
- asp.net MVC + linq to entity报"不允许启动新事务,因为有其他线程正在该会话中运行."错误解决方法
- MVC3"不允许启动新事务,因为有其他线程正在该会话中运行"错误解决方法
- Oracle 查看当前所有会话SQL和等待事件
- 在程序在Unity中运行时,如何在 Unity不是当前窗口的时候,使程序一直在运行?
- 查看当前oracle中正在执行的sql语句
- Android通知之通知栏点击通知后返回正在运行的程序,而不是一个新Activity