当前位置:网站首页>Four characteristics of transactions
Four characteristics of transactions
2022-06-27 15:54:00 【51CTO】
Four characteristics of transactions
What is business
A transaction is a logical set of operations , Or both , Either not .
Classic case
The most classic and often cited example of a transaction is a transfer . If Xiaoming wants to transfer money to Xiaohong 1000 element , There are two key operations involved in this transfer :
- Reduce Xiao Ming's balance 1000 element
- Increase the balance of Xiaohong 1000 element .
The transaction takes these two operations as a logical whole , This whole contains operations that either succeed , Or they all have to fail . In this way, the balance of Xiaoming will not decrease while that of Xiaohong will not increase .
What is a database transaction
Database transactions are the most frequently encountered in our daily development . If your project belongs to a single architecture , You are often exposed to database transactions .
At ordinary times , When we're talking about business , If it doesn't refer to Distributed transactions , It often refers to Database transactions .
What's the use of database transactions ?
Simply speaking : Database transactions can guarantee multiple operations on the database ( That is to say SQL sentence ) Form a logical whole . The database operations that make up this logical whole follow : Or it all works , Or none at all .

in addition , Relational database ( for example :MySQL、SQL Server、Oracle etc. ) Everything has ACID characteristic :
What is business ACID Characteristics
- Atomicity (Atomicity) : Transactions are the smallest unit of execution , Division is not allowed . The atomicity of the transaction ensures that the action is either complete , Or it doesn't work at all ;
- Uniformity (Consistency): Before and after the execution of the transaction , Data consistency , For example, in the transfer business , Whether the transaction is successful or not , The total amount of the transferor and payee should be the same ;
- Isolation, (Isolation): When accessing the database concurrently , One user's transaction is not interfered by other transactions , The database between concurrent transactions is independent ;
- persistence (Durabilily): After a transaction is committed . Its changes to the data in the database are persistent , Even if the database fails, it should not have any impact .
The implementation principle of data transaction ?
We are here to MySQL Of InnoDB Let's take the engine as an example .
MySQL InnoDB Engine USES redo log( Redo log ) Guarantee the business persistence , Use undo log( Rollback log ) To ensure that the business is Atomicity .
MySQL InnoDB The engine goes through Locking mechanism 、MVCC And other means to ensure the isolation of transactions ( The default isolation level supported is REPEATABLE-READ ).
Ensure the persistence of the transaction 、 Atomicity 、 After isolation , Consistency is guaranteed .
This is the end of this article ,
If you have any harvest, you are welcome to like, collect and pay attention to ️, Your encouragement is my biggest motivation .
If you have any wrong questions, you are welcome to point out .
Home page : Share a cup of no blog summaryKeep loving , Go to the next mountain and sea .

边栏推荐
- 我想买固收+产品,但是不了解它主要投资哪些方面,有人知道吗?
- Weekly snapshot of substrate technology 20220411
- Markdown syntax
- Eolink launched a support program for small and medium-sized enterprises and start-ups to empower enterprises!
- PSS: vous n'êtes qu'à deux niveaux du NMS Free + Lifting point | 2021 Paper
- 实现简单的三D立方体自动旋转
- 16 -- 删除无效的括号
- 3.1 simple condition judgment
- Teach you how to package and release the mofish Library
- 漏洞复现----34、yapi 远程命令执行漏洞
猜你喜欢

洛谷入门2【分支结构】题单题解

E ModuleNotFoundError: No module named ‘psycopg2‘(已解决)

VS编译遇到的问题
![Beginner level Luogu 1 [sequence structure] problem list solution](/img/60/5e151ba31eb00374c73be52e3bfa7e.png)
Beginner level Luogu 1 [sequence structure] problem list solution

PSS:你距離NMS-free+提點只有兩個卷積層 | 2021論文

洛谷_P1007 独木桥_思维

PSS: vous n'êtes qu'à deux niveaux du NMS Free + Lifting point | 2021 Paper

SQL injection principle

Programming skills: script scheduling

A distribution fission activity is more than just a circle of friends!
随机推荐
Creation and use of static library (win10+vs2022
3.3 one of the fixed number of cycles
守护雪山之王:这些AI研究者找到了技术的新「用武之地」
Condom giants' sales have fallen by 40% in the past two years. What are the reasons for the decline?
OpenSSF安全计划:SBOM将驱动软件供应链安全
Design of electronic calculator system based on FPGA (with code)
sql注入原理
PolarDB-X现在版本的开源兼容什么?mysql8?
Excuse me, is it cost-effective to insure sunshine Optimus Prime term life insurance No. 7? What are the advantages of this product?
Design of spread spectrum communication system based on FPGA (with main code)
【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
Markdown syntax
Beginner level Luogu 1 [sequence structure] problem list solution
洛谷_P1003 [NOIP2011 提高组] 铺地毯_暴力枚举
Vulnerability recurrence ----- 34. Yapi remote command execution vulnerability
Introduction to TTCAN brick moving
带你认识图数据库性能和场景测试利器LDBC SNB
About tensorflow using GPU acceleration
LeetCode每日一练(主要元素)
Eolink 推出面向中小企业及初创企业支持计划,为企业赋能!