当前位置:网站首页>Mysq index optimization and how to avoid deadlock
Mysq index optimization and how to avoid deadlock
2022-06-22 08:25:00 【ambition_ forever】
1、 Use overlay indexes to avoid backtracking .
2、 Optimize queries using self incrementing fields as primary keys .
3、 Prefix index , Reduce index presence pages , Then the query is reduced io, Increase of efficiency .
order by Cannot use prefix index , Cannot use prefix index as overlay index .
4、 If... Is used in query criteria or, And or There is no condition in the index before and after , Then the index will not be used .
5、 You can try to pass force index To force the use of indexes .
6、mysql Transaction isolation through Lock to achieve , Atomicity and consistency of transactions are achieved through undolog and mvcc Realization .
The persistence of transactions is achieved through redolog + binlog To guarantee
7、 The specific implementation algorithm of row lock record lock、gap lock as well as next-key lock. Common deadlocks are in rr Under transaction isolation level select for update Will add gap lock.
8、 Avoid deadlocks Set timeout innodb_lock_wait_timeout To set the timeout , Avoid waiting for each other ; Avoid long affairs , Disassemble the transaction , Reduce the probability of conflicts with other transactions . Turn on Deadlock Detection innodb_deadlock_detect = on Turn on Deadlock Detection , When it happens mysql Choose rollback .
9、 Shared locks and exclusive locks belong to row locks , Intention lock belongs to table lock .
边栏推荐
- Email giant exposes serious vulnerability, user data is stolen
- Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - common functions of MQL language
- Learn data warehouse together - Zero
- 计算天数()
- Store the numbers in the array in reverse order
- Questions 101 to 200 of the national information security grade examination nisp level 1 question bank (1)
- Type of sub database and sub table
- Idea reports an error "insufficient memory"
- Bee framework, an ORM framework that can be learned in ten minutes --bee
- 中断中为何不能使用信号量,中断上下文为何不能睡眠
猜你喜欢

Spark Yarn内存资源计算分析(参考)--Executor Cores、Nums、Memory优化配置

Any to Any 实时变声的实现与落地丨RTC Dev Meetup

steam教育文化传承的必要性

矩阵分解

Basic concepts of homomorphic encryption

FastCorrect:语音识别快速纠错模型丨RTC Dev Meetup

The challenge of image based voice processing in real-time audio and video -- RTC dev Meetup

培养以科学技能为本的Steam教育

Mt4/mql4 getting started to mastering EA tutorial lesson 8 - common functions of MQL language (VIII) - common time function

Example of QT qtableview
随机推荐
Is pioneer futures safe? What are the procedures for opening futures accounts? How to reduce the futures commission?
Installing SQL Server 2008 by image in Windows Service 2008
Define the data source of hikaricp connection pool for bee
Using KDJ metrics on MT4
将数组中的数逆序存放
MySQL query database capacity
培养以科学技能为本的Steam教育
Restrict input type (multiple methods)
Bee framework, an ORM framework that can be learned in ten minutes --bee
Mainstream design of database middleware
C # interface holding structure causes packing problem
DTD约束
Bee read write separation Usage Summary
年度十强!赛宁网安再次入围《中国数字安全百强报告》
Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - common functions of MQL language
Mt4/mql4 getting started to mastering EA tutorial lesson 4 - common functions of MQL language (IV) - common functions of K-line value
Prompt installremove of the Service denied when installing MySQL service
JSON usage example
Spark Yarn内存资源计算分析(参考)--Executor Cores、Nums、Memory优化配置
I spring and autumn web Penetration Test Engineer (elementary) learning notes (Chapter 3)