当前位置:网站首页>事务的基本特性和隔离级别
事务的基本特性和隔离级别
2022-07-05 12:43:00 【51CTO】
事务的特性
事务的定义很严格,它必须同时满足四个特性,即原子性、一致性、隔离性和持久性,也就是人们俗称的 ACID 特性,具体如下。
1)原子性(Atomic)
表示是⼀个事务中的操作要么全部成功,要么全部失败。
2)一致性(Consistency)
指的是数据库总是从⼀个⼀致性的状态转换到另外⼀个⼀致性的状态。
3)隔离性(Isolation)
指的是⼀个事务的修改在最终提交前,对其他事务是不可⻅的。
4)持久性(Durability)
指的是⼀旦事务提交,所做的修改就会永久保存到数据库中。
事务的隔离级别
隔离级别 | 中文名称 |
---|---|
read uncommint | 读未提交 |
read commit | 读已提交 |
repeatable read | 可重复读 |
serializable | 串行化 |
- read uncommit 读未提交,可能会读到其他事务未提交的数据,也叫做脏读。
- ⽤户本来应该读取到id=1的⽤户age应该是10,结果读取到了其他事务还没有提交的事务,结果读取结果age=20,这就是脏读。
- read commit 读已提交,两次读取结果不⼀致,叫做不可重复读。 不可重复读解决了脏读的问题,他只会读取已经提交的事务。
- ⽤户开启事务读取id=1⽤户,查询到age=10,(其他事务已提交)再次读取发现结果=20,在同⼀个事务⾥同⼀个查询 读取到不同的结果叫做不可重复读。
- repeatable read 可重复复读,这是mysql的默认级别,就是每次读取结果都⼀样,但是有可能产生幻读。
- serializable 串⾏,⼀般是不会使⽤的,他会给每⼀⾏读取的数据加锁,会导致大量超时和锁竞争的问题。
边栏推荐
- Principle and performance analysis of lepton lossless compression
- Why is your next computer a computer? Explore different remote operations
- About the single step debugging of whether SAP ui5 floating footer is displayed or not and the benefits of using SAP ui5
- Transactions from January 6 to October 2022
- Association modeling method in SAP segw transaction code
- 以VMware创新之道,重塑多云产品力
- Simply take stock reading notes (4/8)
- SAP UI5 DynamicPage 控件介紹
- CVPR 2022 | single step 3D target recognizer based on sparse transformer
- 逆波兰表达式
猜你喜欢
Super efficient! The secret of swagger Yapi
RHCSA5
What if wechat is mistakenly sealed? Explain the underlying logic of wechat seal in detail
HiEngine:可媲美本地的云原生内存数据库引擎
From the perspective of technology and risk control, it is analyzed that wechat Alipay restricts the remote collection of personal collection code
SAP self-development records user login logs and other information
Transactions from December 27 to 28, 2021
RHCSA3
关于 SAP UI5 floating footer 显示与否的单步调试以及使用 SAP UI5 的收益
无密码身份验证如何保障用户隐私安全?
随机推荐
国内市场上的BI软件,到底有啥区别
Introduction to sap ui5 flexiblecolumnlayout control
关于 SAP UI5 floating footer 显示与否的单步调试以及使用 SAP UI5 的收益
A specific example of ABAP type and EDM type mapping in SAP segw transaction code
SAP SEGW 事物码里的 ABAP 类型和 EDM 类型映射的一个具体例子
百日完成国产数据库opengausss的开源任务--openGuass极简版3.0.0安装教程
Reshape the power of multi cloud products with VMware innovation
Alipay transfer system background or API interface to avoid pitfalls
Taobao order amount check error, avoid capital loss API
946. Verify stack sequence
DNS的原理介绍
关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
JXL notes
Transactions on December 23, 2021
[Nacos cloud native] the first step of reading the source code is to start Nacos locally
Association modeling method in SAP segw transaction code
阿里云SLB负载均衡产品基本概念与购买流程
SAP 自开发记录用户登录日志等信息
Taobao short video, why the worse the effect
mysql拆分字符串做条件查询