当前位置:网站首页>MySQL死锁问题如何解决?背诵版
MySQL死锁问题如何解决?背诵版
2022-06-11 08:21:00 【梵高的猪v】
MySQL的死锁:
两个或两个以上的事务因为互相竞争对方的资源而导致循环等待的现象成为死锁.
如何解决死锁:
可以使用show engine innodb status语句去查看sql语句状态.然后根据对应的死锁sql找到占用的锁.
比如说: 事务A占用了a表的锁,事务B占用了b表的锁,如果此刻事务A要求占用b表的锁就得让事务b去释放b表的锁,但如果这个时候事务b也要求占用事务a的锁,就得要求事务a去释放占用a表的锁,这样子大家都循环等待,就造成了死锁.这个时候我们应该顺序让他们去占用锁,让事务ab顺序占用a锁,顺序占用b锁,这样子造成的问题无非就是哪个事务先占用锁的问题,并不会产生循环等待的情况
还比如: 在事务A执行任务的时候产生了间隙锁(-无穷,2),事务b产生了间隙锁(1,+无穷),这个时候如果事务a去执行更新3的操作,就得要求事务b去释放锁,而事务b要去执行更新0的时候就得要求事务a去释放锁.造成了互相等待的局面,这个时候就要去尝试更改逻辑删除间隙锁,或者去更改间隙锁的范围.
边栏推荐
- Asynchronous notification mechanism of character device driver
- Solve notimplementederror: layer XX has arguments in`__ init__` and therefore must override `get_ config`
- The difference between & & and &
- Typescript configuring ts in koa and using koa router
- Modifying field length in Oracle and postgrepsql
- Solve cannot import name 'multiheadattention' from 'tensorflow keras. layers‘
- Method summary of creating deep learning model with keras/tensorflow 2.9
- In place reversal of a LinkedList
- (resolved) the tqdm progress bar in the Jupiter notebook does not update and display in one line, but scrolls down to output
- torch. unbind()
猜你喜欢

Printing diamond of beginner C

Web design and website planning assignment 11 game selection form

XXL task executor calls local project

Crawl Baidu Baipin dynamic page

【CVPR2022】QueryDet论文精读

(transformation) tree, binary tree and forest transformation principle

并查集是什么?你还在为其烦恼?其实就是一个连通图的问题,理解起来没有那么困难
![[the most complete ENSP [installation diagram] in history!]](/img/1a/7d50d6e5c06a5e3ce6acab16ddb638.jpg)
[the most complete ENSP [installation diagram] in history!]

盘它!用「飞项」轻松管理各类型项目

Solution to the occurrence interval (space) of latex manual numbering documents
随机推荐
Redis cluster in Linux system
Web design and website planning assignment 11 game selection form
Scrape captures 51job Recruitment Information (static page)
torch. Var (), sample variance, parent variance
The difference between & & and &
Typescript class and interface, class and generic, interface merging
TypeScript-unknown类型
怎么做好项目管理?学会这4个步骤就够了
Don't want the project out of control? You need to use project management tools
Project training - clonemon
Uniapp plug-in development
Selenium click the floating menu and realize the functions of right mouse button
Multiple limit of the same field of SQL
(taking pytorch as an example) a simple understanding of the regularization method of path (depth) -drop path
Idea pulls items from remote warehouse
Printing diamond of beginner C
How to do well in empty state design? Look at this comprehensive summary
The role of lambdalr in pytorch
Typescript distributed condition type
Thoroughly remember the difference between ImageView background and SRC