当前位置:网站首页>Causes and solutions of lock table
Causes and solutions of lock table
2022-08-01 05:20:00 【Yangtze river snow】
First, the reasons for the lock table
1. The lock table occurs in insert update and delete;
2. The principle of locking the table is that the database uses an exclusive locking mechanism. When the above statement is executed, the table is locked until a commit or rollback occurs or the database user exits;
3. Reasons for locking the table:
1) When program A executes the insert to tableA and has not yet committed, program B also inserts tableA, then an exception that resources are busy will occur at this time, which is the lock table;
2), the lock table often occurs in concurrency rather than in parallel (in parallel, when one thread operates the database, another thread cannot operate the database, the principle of cpu and i/o allocation)
4. Reduce the probability of locking the table:
Reduce the time between the execution of the insert, update, and delete statements to the commite.
The specific point is that batch execution is changed to single execution, and the non-execution speed of sql itself is optimized.
If there is an abnormality, things will be rolled back.
Second, mysql lock table solution
#View the process id, then kill the process with kill id
show processlist;
SELECT * FROM information_schema.PROCESSLIST;
#Query the executing process
SELECT * FROM information_schema.PROCESSLIST where length(info) >0 ;
#Query whether to lock the table
show OPEN TABLES where In_use > 0;
#View locked
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
#Waiting for lock
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
#kill the lock table process
kill 5601
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- 报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
- 力扣(LeetCode)212. 单词搜索 II(2022.07.31)
- 初识shell脚本
- Selenium: Element wait
- 状态压缩dp
- 请求/响应拦截器写法
- MySQL-Data Definition Language-DDLdatebase define language
- vim配置+ctag像source insight一样方便阅读代码
- 25. Have you been asked these three common interview questions?
- 文件的异步读写
猜你喜欢

(2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)

状态压缩dp

字符中的第一个唯一字符

I met a shell script

移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障

pytroch、tensorflow对比学习—功能组件(数据管道、回调函数、特征列处理)

Logitech Mouse Experience Record

Check控件

(Codeforce 757) E. Bash Plays with Functions

About making a progress bar for software initialization for Qt
随机推荐
4D line-by-line analysis and implementation of Transformer, and German translation into English (3)
WPF入门项目必知必会-初步了解数据绑定 binding
typescript24 - type inference
(2022 Nioke Duo School IV) H-Wall Builder II (Thinking)
LeetCode 231. 2 的幂
typescript21 - Comparison of Interfaces and Type Aliases
Robot_Framework: Assertion
NUMPY
Excel record of integer programming optimization model to solve the problem
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
(Codeforce 757) E. Bash Plays with Functions
II. Binary tree to Offer 68 - recent common ancestor
牛客多校2022第四场A,H,K,N
About making a progress bar for software initialization for Qt
LeetCode 1189. “气球” 的最大数量
2022.7.27好题选讲
vim配置+ctag像source insight一样方便阅读代码
25. Have you been asked these three common interview questions?