当前位置:网站首页>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
边栏推荐
- Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
- DL-31/6电流继电器
- 2022.7.26 模拟赛
- 关于给Qt做一个软件初始化的进度条
- WPF入门项目必知必会-初步了解数据绑定 binding
- 可持久化线段树
- 状态压缩dp
- 2022年湖南工学院ACM集训第六次周测题解
- 用控件当画笔获得bitmap代码记录
- y83. Chapter 4 Prometheus Factory Monitoring System and Actual Combat -- Advanced Prometheus Alarm Mechanism (14)
猜你喜欢
剑指 Offer 68 - II. 二叉树的最近公共祖先
A,H,K,N
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
typescript28 - value of enumeration type and data enumeration
Optional parameters typescript19 - object
七、MFC序列化机制和序列化类对象
SL-12/2过流继电器
(Codeforce 757)E. Bash Plays with Functions(积性函数)
typescript27 - what about enumeration types
【MySQL必知必会】 表的优化 | 充分利用系统资源
随机推荐
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
pytroch、tensorflow对比学习—搭建模型范式(低阶、中阶、高阶API示例)
Robot_Framework: keyword
MySQL-Data Operation-Group Query-Join Query-Subquery-Pagination Query-Joint Query
pytorch、tensorflow对比学习—计算图和微分机制
AspNet.WebApi.Owin 自定义Token请求参数
MySQL实践总结-
2022.7.26 模拟赛
【MySQL必知必会】 表的优化 | 充分利用系统资源
MySQL Practice Summary -
微信小程序获取手机号phonenumber.getPhoneNumber接口开发
MySQL-数据定义语言-DDLdatebase define language
The method of solving stored procedure table name passing through variable in mysql
JWL-11/2-99.9A电流继电器
Challenge 52 days to memorize Peppa Pig (Day 01)
ModuleNotFoundError: No module named ‘tensorflow.keras‘报错信息的解决方法
NDK does not contain any platforms问题解决
备战金九银十,如何顺利通过互联网大厂Android的笔面试?
WebSocket实现聊天功能
(2022 Nioke Duo School IV) H-Wall Builder II (Thinking)