当前位置:网站首页>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 .
边栏推荐
- Can netstat still play like this?
- The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
- 从输入URL到页面展示这中间发生了什么?
- Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
- Kubernetes cluster log and efk architecture log scheme
- Can netstat still play like this?
- I2C 子系统(四):I2C debug
- Variable declarations following if statements
- What does it mean when lambda is not entered?
- 从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
猜你喜欢

Sqlserver row to column pivot

Creation and destruction of function stack frame

Practice of traffic recording and playback in vivo

Agile certification (professional scrum Master) simulation exercise-2

Anhui University | small target tracking: large-scale data sets and baselines

Kubernetes cluster log and efk architecture log scheme

迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/7e/ad9ea78868126b149bd9f15f587e6c.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]

MySql實戰45講【SQL查詢和更新執行流程】

I2C 子系統(四):I2C debug
随机推荐
MySQL practice 45 [global lock and table lock]
Counter统计数量后,如何返回有序的key
[fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)
Joking about Domain Driven Design (III) -- Dilemma
Kubernetes family container housekeeper pod online Q & A?
Kubernetes family container housekeeper pod online Q & A?
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
Use of check boxes: select all, deselect all, and select some
Yiwen takes you to know ZigBee
当lambda没有输入时,是何含义?
Docker install MySQL
I2C 子系統(四):I2C debug
Edit and preview in the back pipe to get the value writing method of the form
SQL server queries the table structure of the specified table
MySql实战45讲【行锁】
How to implement append in tensor
The difference between left value and right value in C language
I2C 子系统(二):I3C spec
[C language] MD5 encryption for account password
Practice of traffic recording and playback in vivo