当前位置:网站首页>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 .
边栏推荐
- How to make backgroundworker return an object
- Introduction to cron expression
- Notifydatasetchanged not applicable to recyclerview - notifydatasetchanged not working on recyclerview
- TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
- js根据树结构查找某个节点的下面的所有父节点或者子节点
- Le processus de connexion mysql avec docker
- The process of connecting MySQL with docker
- Do you really understand relays?
- 销毁Session和清空指定的属性
- sql server数据库添加 mdf数据库文件,遇到的报错
猜你喜欢

docker安装mysql

HW initial preparation

Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training

用docker 连接mysql的过程

Pytest (6) -fixture (Firmware)

Anhui University | small target tracking: large-scale data sets and baselines
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/c7/6b5ab4ff7379bfccff7cdbb358ff8f.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
![ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc](/img/cb/145937a27ef08050a370d5a255215a.jpg)
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc

左连接,内连接

Kubernetes cluster log and efk architecture log scheme
随机推荐
Anhui University | small target tracking: large-scale data sets and baselines
Kubernetes family container housekeeper pod online Q & A?
Agile certification (professional scrum Master) simulation exercises
敏捷认证(Professional Scrum Master)模拟练习题
MySql实战45讲【索引】
销毁Session和清空指定的属性
MySQL practice 45 [SQL query and update execution process]
Introduction to cron expression
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Source code analysis | resource loading resources
[fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)
Add MDF database file to SQL Server database, and the error is reported
Check log4j problems using stain analysis
Reset or clear NET MemoryStream - Reset or Clear . NET MemoryStream
js根据树结构查找某个节点的下面的所有父节点或者子节点
MySql实战45讲【SQL查询和更新执行流程】
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
SQL Server Query spécifie la structure de la table
Chart. JS multitooltip tag - chart js multiTooltip labels