当前位置:网站首页>Isolation level of MySQL, possible problems (dirty reading, unrepeatable reading, phantom reading) and their solutions
Isolation level of MySQL, possible problems (dirty reading, unrepeatable reading, phantom reading) and their solutions
2022-07-29 00:42:00 【lonelyMangoo】
Sum up MySQL Isolation level 、 Possible problems and solutions .
| Isolation level | Concept | Realization way | What happened | The phenomenon | Illustrate with examples | resolvent |
|---|---|---|---|---|---|---|
| Read uncommitted | When a transaction has not yet been committed , The changes it makes can be seen by other things | Directly return the latest value | Dirty reading | Read data that other transactions have not been committed or rolled back | A Transaction read B Uncommitted data | The isolation level is set to read committed |
| Read submitted | After a transaction is committed , The changes it makes will be seen by other things | SQL Create a view when the statement executes | It can't be read repeatedly | The data read in a transaction is different ( During this period, other affairs were submitted ) | A The transaction uses the same query statement twice , The result is different . | The isolation level is set to repeatable |
| Repeatable ( Default ) | Data seen during the execution of a transaction , It is always consistent with the data seen when the transaction is started . Of course, at the level of repeatable read isolation , Uncommitted changes are also invisible to other transactions . | Create a view when the transaction starts , Use this view throughout the transaction . | Fantasy reading | A transaction is retrieved under the same conditions , Found new data ( Can't find the modified data ) | A Transactions put a field in the table +1, It happens to be this time of business B A piece of data is inserted into the table .A After submitting the transaction, the user finds that there is still data that has not been modified , It's like a hallucination . | The isolation level is set to serialization ( Poor efficiency ), Don't suggest .|| Add range lock RangeS, Lock search scope to read only |
| Serialization | As the name suggests, for the same line of records ,“ Write ” Will add “ Write lock ”,“ read ” Will add “ Read the lock ”. When there is a read/write lock conflict , Subsequent transactions must wait for the previous transaction to complete , In order to proceed . | Lock |
Problems with high isolation levels can occur at low isolation levels , For the sake of brevity, it is not reflected in the table
Some small concepts :
- The isolation level is also to complete ACID Medium I(Isolation), Isolated type
- MVCC( Multi version concurrency control ) Help complete the implementation of isolation
- MySQL Native MyISAM The engine does not support transactions , By InnoDB replace
Partial reference MySQL45 speak
边栏推荐
- What are the skills of API interface optimization?
- Use hutool tool class to operate excel with more empty Sheet1
- How to solve Oracle not available
- vulnhub:SolidState
- 最长上升子序列
- 【网络安全】通过iptables和ipset完成服务器防火墙黑名单和白名单功能
- I was asked several questions about string in the interview. Can you answer them?
- CDN mode uses vant components, and components cannot be called after they are introduced
- flask结合容联云发送验证码
- Alibaba Code代码索引技术实践:为Code Review提供本地IDE的阅读体验
猜你喜欢

16. Influence of deviation, variance, regularization and learning curve on the model

2022dasctfjuly empowerment competition (reappearance)

Recursion / backtracking (Part 2)

乱打日志的男孩运气怎么样我不知道,加班肯定很多!

Talk about seven ways to realize asynchronous programming

【开发教程11】疯壳·开源蓝牙心率防水运动手环-整机功能代码讲解

How to solve the problems of MQ message loss, duplication and backlog?

15.模型评估和选择问题

Application and principle of distributed current limiting redistribution rratelimiter

Requestvideoframecallback() simple instance
随机推荐
Flask sends verification code in combination with Ronglian cloud
PTA (daily question) 7-70 diamond
Common measurement matrix and matlab code of compressed sensing
15. Model evaluation and selection
动态规划问题(四)
刷题的第三十天
Kali installs burpsuite professional
Recursion / backtracking (middle)
[network security] complete the blacklist and whitelist functions of server firewall through iptables and ipset
The 30th day of question brushing
Locally connect to redis on Windows Server
@Detailed explanation of postconstruct annotation
面试被问到了String相关的几道题,你能答上来吗?
1331. Array sequence number conversion: simple simulation question
Longest ascending subsequence
Installation and use of pnpm
Download the latest version of visual studio code and connect to the server remotely (very detailed)
Requestvideoframecallback() simple instance
Solutions such as failed plug-in installation and slow speed of linking remote server under vscode
SAP VL02N 交货单过账函数 WS_DELIVERY_UPDATE