当前位置:网站首页>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 .
边栏推荐
- js根据树结构查找某个节点的下面的所有父节点或者子节点
- Change cell color in Excel using C - cell color changing in Excel using C
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- Last update time of all sqlserver tables
- 分布式事务
- [principles of multithreading and high concurrency: 1_cpu multi-level cache model]
- The core idea of performance optimization, dry goods sharing
- Force freeing memory in PHP
- 二维数组中的元素求其存储地址
- Chart. JS multitooltip tag - chart js multiTooltip labels
猜你喜欢

敏捷认证(Professional Scrum Master)模拟练习题-2

用docker 连接mysql的过程

TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
![[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling](/img/c3/b9a614001f80345a5c1cb3c68ab27c.jpg)
[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling

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

内存泄漏工具VLD安装及使用

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

From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character

Practice of traffic recording and playback in vivo

Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
随机推荐
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
Can I use read-only to automatically implement properties- Is read-only auto-implemented property possible?
Use optimization | points that can be optimized in recyclerview
docker安装redis
分布式事务
Destroy the session and empty the specified attributes
js根据树结构查找某个节点的下面的所有父节点或者子节点
销毁Session和清空指定的属性
The difference between left value and right value in C language
Anhui University | small target tracking: large-scale data sets and baselines
How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
Le processus de connexion mysql avec docker
Edit and preview in the back pipe to get the value writing method of the form
力扣------网格中的最小路径代价
Can netstat still play like this?
Use of check boxes: select all, deselect all, and select some
Kubernetes family container housekeeper pod online Q & A?
C语言中左值和右值的区别
How to implement append in tensor