当前位置:网站首页>Basic characteristics and isolation level of transactions
Basic characteristics and isolation level of transactions
2022-07-05 13:34:00 【51CTO】
The nature of transactions
Transactions are strictly defined , It has to satisfy four characteristics at the same time , namely Atomicity 、 Uniformity 、 Isolation and persistence , It is also known as ACID characteristic , As follows .
1) Atomicity (Atomic)
Said is ⼀ All operations in a transaction are either successful , All or nothing .
2) Uniformity (Consistency)
It means that the database always starts from ⼀ individual ⼀ The state of causation changes to another ⼀ individual ⼀ The state of being sexual .
3) Isolation, (Isolation)
refer to ⼀ Modification of a transaction before final commit , For other matters is not ⻅ Of .
4) persistence (Durability)
refer to ⼀ Once the transaction is committed , The changes will be permanently saved to the database .
The isolation level of the transaction
Isolation level | Chinese name |
---|---|
read uncommint | Read uncommitted |
read commit | Read submitted |
repeatable read | Repeatable |
serializable | Serialization |
- read uncommit Read uncommitted , You may read uncommitted data from other transactions , It's also called Dirty reading .
- ⽤ The user should have read id=1 Of ⽤ Household age Should be 10, As a result, transactions that have not been committed by other transactions are read , Results read results age=20, This is dirty reading .
- read commit Read submitted , The results of two readings are not ⼀ Cause , It's called non repeatable reading . Non repeatable reading solves the problem of dirty reading , He will only read transactions that have been committed .
- ⽤ The user starts transaction reading id=1⽤ Household , Query to age=10,( Other transactions committed ) Read the result again =20, At the same time ⼀ One transaction ⾥ Same as ⼀ A query Reading different results is called non repeatable .
- repeatable read Repeatable , This is a mysql Of Default level , Is that every time you read the result ⼀ sample , But there are May produce unreal reading .
- serializable strand ⾏,⼀ Generally, it won't make ⽤ Of , He will give everyone ⼀⾏ Lock the read data , Meeting Lead to a lot of timeout and lock competition .
边栏推荐
猜你喜欢
随机推荐
Go array and slice
go 数组与切片
SAE international strategic investment geometry partner
个人组件 - 消息提示
Datapipeline was selected into the 2022 digital intelligence atlas and database development report of China Academy of communications and communications
Idea set method annotation and class annotation
jenkins安装
Win10——轻量级小工具
“百度杯”CTF比赛 九月场,Web:Upload
Cloudcompare - point cloud slice
Notion 类笔记软件如何选择?Notion 、FlowUs 、Wolai 对比评测
【Hot100】34. 在排序数组中查找元素的第一个和最后一个位置
Mmseg - Mutli view time series data inspection and visualization
Integer = = the comparison will unpack automatically. This variable cannot be assigned empty
Go pointer
MySQL - database query - sort query, paging query
Write API documents first or code first?
Flutter draws animation effects of wave movement, curves and line graphs
【每日一题】1200. 最小绝对差
这18个网站能让你的页面背景炫酷起来