当前位置:网站首页>MySQL practice 45 lecture [row lock]
MySQL practice 45 lecture [row lock]
2022-07-03 03:06:00 【Little fish 2020】
List of articles
07 | The merits and demerits of line lock : How to reduce the impact of row locks on performance ?
InnoDB It supports row locking .
Row locks are locks for row records in the data table . That makes sense , For example, affairs. A Updated a line , And at this time business B Also update the same line , Then we have to wait for business A You can't update until the operation of .
Start with two-stage locking 
If you need to lock multiple rows in your transaction , The most likely cause of lock conflict 、 The lock most likely to affect concurrency should be put back as far as possible 
Deadlock and deadlock detection
When different threads in a concurrent system have cyclic resource dependency , The threads involved are waiting for other threads to release resources , It will cause these threads to enter the state of infinite waiting , Deadlock . Here I use row locks in the database as an example .
-- Query transaction lock wait time , Unit second , Non interactive
show variables like "innodb_lock_wait_timeout%"
set innodb_lock_wait_timeout=100;
innodb_lock_wait_timeout It refers to the maximum waiting time for a transaction to acquire resources ,
If the resource is not allocated after this time, the application will fail
-- Whether deadlock check is enabled
show variables like "innodb_deadlock_detect%"

Summary
innodb Row level locking is achieved by locking index records .
If update No index ,innodb Inside, the whole table is scanned row by row according to the primary key index Lock line by line , The lock is released uniformly when the transaction is committed .
边栏推荐
猜你喜欢

The process of connecting MySQL with docker

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)

从C到Capable-----利用指针作为函数参数求字符串是否为回文字符

Kubernetes cluster log and efk architecture log scheme

超好用的日志库 logzero

TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制

MySql实战45讲【SQL查询和更新执行流程】

分布式事务

Opengauss database development and debugging tool guide

Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
随机推荐
Docker install MySQL
【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
Kubernetes cluster log and efk architecture log scheme
Strategy application of Dameng database
Notifydatasetchanged not applicable to recyclerview - notifydatasetchanged not working on recyclerview
敏捷认证(Professional Scrum Master)模拟练习题-2
Joking about Domain Driven Design (III) -- Dilemma
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
Edit and preview in the back pipe to get the value writing method of the form
What does it mean when lambda is not entered?
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
How to make backgroundworker return an object
I2C 子系统(二):I3C spec
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
sql server数据库添加 mdf数据库文件,遇到的报错
后管中编辑与预览获取表单的值写法
Sqlserver row to column pivot
The process of connecting MySQL with docker
Add MDF database file to SQL Server database, and the error is reported