标签:超时 select sql_id 状态 alt nod blank .com str
select * from innodb_lock_waits; select * from innodb_locks limit 2\G select * from information_schema.innodb_trx\G select * from information_schema.innodb_trx where trx_id = 45734628\G
SELECT lw.requesting_trx_id AS request_ID, trx.trx_mysql_thread_id as request_mysql_ID, trx.trx_query AS request_command, lw.blocking_trx_id AS blocking_ID, trx1.trx_mysql_thread_id as blocking_mysql_ID, trx1.trx_query AS blocking_command, lo.lock_index AS lock_index FROM information_schema.innodb_lock_waits lw INNER JOIN information_schema.innodb_locks lo ON lw.requesting_trx_id = lo.lock_trx_id INNER JOIN information_schema.innodb_locks lo1 ON lw.blocking_trx_id = lo1.lock_trx_id INNER JOIN information_schema.innodb_trx trx ON lo.lock_trx_id = trx.trx_id INNER JOIN information_schema.innodb_trx trx1 ON lo1.lock_trx_id = trx1.trx_id;
1: INNODB_LOCKS
root@localhost [(none)]>start transaction; Query OK, 0 rows affected (0.00 sec) root@localhost [(none)]>update qiandai.t1 set col_int_key=333 where pk=10; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
第二个终端直接也更新同一行数据:
update qiandai.t1 set col_int_key=222 where pk=10;
然后去查看三个表联合查询:
SHOW VARIABLES LIKE ‘%LOCK_WAIT%‘;
上面可以查看到锁等待的超时时间,INNODB默认五十秒。
标签:超时 select sql_id 状态 alt nod blank .com str
原文地址:http://www.cnblogs.com/shengdimaya/p/6891897.html