mysql当消息队列用(不可重复读)
以下在一个事务中执行,
1)如果查询条件有索引,锁住索引
2)如果查询条件没索引,锁表
3)这里对读不带for update的不影响,select for update的话会等待。
select * from t_beef_receive where beefSendId = #{beefSendId} and type = 0 limit 1 for update;
update t_beef_receive xxx
几个怕碰见死锁查mysql状态的sql:
show open tables where in_use >0
show status like 'innodb_row_lock%';
select * from information_schema.innodb_locks
select * from information_schema.innodb_lock_waits