当前位置:网站首页>Transaction isolation level gap lock deadlock
Transaction isolation level gap lock deadlock
2022-07-01 19:36:00 【Like this, I】
1. Transaction isolation level
- serialize (SERIALIZABLE)
- Repeatable (REPEATABLE READ)
- Submit to read (READ COMMITTED)
- Uncommitted read (READ UNCOMMITTED)
The four isolation levels correspond to addition, deletion, modification and query
2.gap Lock analysis :
Uncommitted read (READ UNCOMMITTED): Add, delete, change and check without locking .
Submit to read (READ COMMITTED): Increase the time to lock the index a certain distance ( If the index is 12, Lock an index in 12 A distance up and down ), Release the lock when the transaction is committed .
Repeatable (REPEATABLE READ): Lock the index for a distance when adding, deleting or modifying data (insert Above , If the index is 12, Then lock the distance between the indexes of the previous row and the next row , If there is no previous line or next line , Then lock a distance )
serialize (SERIALIZABLE): Add, delete, change and check will be locked , Transactions can only be committed one by one , The obtained transaction locks the table directly
3.gap Deadlock
Two transaction colleagues obtained an interval lock , And simultaneously operate the interval
111 delete from ts_column_log_test wherecol_id=10;
222 delete from ts_column_log_test where col_id=11;
111 INSERT INTO ts_column_log_test (col_id,start_time, end_time, data_time, status) VALUES (10, NULL, NULL, '20111209','running');
222 INSERT INTO ts_column_log_test (col_id, start_time, end_time,data_time, status) VALUES (11, NULL, NULL, '20111209', 'running');
This is the time , You may get an error message ERROR 1213 (40001): Deadlock found when trying toget lock; try restarting transaction.
The reason is that the first two statements have been obtained [2,20) Recorded in this interval S lock , Then, the two transactions are performed on col_id=10 This location request X lock , Then a deadlock occurs , No one can ask X lock , Because they both hold S lock .
边栏推荐
- Nacos configuration file publishing failed, please check whether the parameters are correct solution
- Task: denial of service DOS
- 寶,運維100+服務器很頭疼怎麼辦?用行雲管家!
- Use the uni app demo provided by Huanxin to quickly realize one-on-one chat
- Solidity - truncated and checked modes of arithmetic operations - new features of 0.8.0
- [go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function
- Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
- 数字化转型企业成功的关键,用数据创造价值
- web开发常用的开源框架的开源协议整理
- XML语法、约束
猜你喜欢

Flutter 实战-快速实现音视频通话应用

What must be done in graduation season before going to Shanhai

Solidity - truncated and checked modes of arithmetic operations - new features of 0.8.0

EasyGBS主子码流都为H.265时,切换出现花屏如何解决?

Helium transmission line of lake shore cryostat

EasyGBS网络不稳定情况下重复请求视频拉流问题的优化

Introduction to relevant processes and functions of wechat official account development

XML语法、约束

线程的并行、并发、生命周期
![[to.Net] C set class source code analysis](/img/59/4c7b910bc6505e5f81015ce80812fc.png)
[to.Net] C set class source code analysis
随机推荐
English语法_形容词/副词3级 -注意事项
[English grammar] Unit1 articles, nouns, pronouns and numerals
Implement a Prometheus exporter
Ffmpeg error code
The use of subplot function in MATLAB
Parallelism, concurrency and life cycle of threads
H264 encoding profile & level control
GetMessage底层机制分析
Boost the development of digital economy and consolidate the base of digital talents - the digital talent competition was successfully held in Kunming
测试自学人必看:软件测试如何找测试项目?
sql查询去重统计的方法总结
Go语言高级
【Go ~ 0到1 】 第四天 6月30 defer,结构体,方法
Les canaux de culture intensive s'efforcent de développer Fu Xin et Wei Shi jiajie pour organiser une conférence de formation sur les nouveaux produits
PostgreSQL varchar[] array type operation
XML语法、约束
论文阅读【Learning to Discretely Compose Reasoning Module Networks for Video Captioning】
赋能「新型中国企业」,SAP Process Automation 落地中国
如何正确使用Vertx操作Redis(3.9.4带源码分析)
Interview questions for audio and video positions in Dachang -- today's headline