省流:
查询正在进行的事务
SELECT * FROM information_schema.innodb_trx;
#根据条件查processlist
select * from information_schema.processlist where id='xx';
杀死进程
kill id;
正文:
经常会遇到mysql死锁等突发情况。
这次遇到一个进程执行时间过长,10几天...非常离谱。
执行:
SELECT * FROM information_schema.innodb_trx;
结果:
trx_id |512305234990167
trx_state |RUNNING
trx_started |2023-09-22 23:13:16
trx_requested_lock_id |
trx_wait_started |
trx_weight |0
trx_mysql_thread_id |612871
trx_query |/*ApplicationName=DataGrip 2020.3.2 */ select xx from xx where x
trx_operation_state |fetching rows
trx_tables_in_use |3
trx_tables_locked |0
trx_lock_structs |0
trx_lock_memory_bytes |1136
trx_rows