当前位置:网站首页>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 .

边栏推荐
- Cesium 使用MediaStreamRecorder 或者MediaRecorder录屏并下载视频,以及开启摄像头录像。【转】
- #27ES6的数值扩展
- Introduction to TTCAN brick moving
- Eolink launched a support program for small and medium-sized enterprises and start-ups to empower enterprises!
- 如果想用dms来处理数据库权限问题,想问下账号只能用阿里云的ram账号吗(阿里云的rds)
- 专家:让你低分上好校的都是诈骗
- Cesium uses mediastreamrecorder or mediarecorder to record screen and download video, as well as turn on camera recording. [transfer]
- Design of digital video signal processor based on FPGA (with main code)
- Knightctf 2022 web section
- 3.3 one of the fixed number of cycles
猜你喜欢

Luogu_ P1007 single log bridge_ thinking
![Beginner level Luogu 1 [sequence structure] problem list solution](/img/60/5e151ba31eb00374c73be52e3bfa7e.png)
Beginner level Luogu 1 [sequence structure] problem list solution

Vulnerability recurrence ----- 34. Yapi remote command execution vulnerability

Teach you how to package and release the mofish Library

面试半年,上个月成功拿到阿里P7offer,全靠我啃烂了这份2020最新面试题!

Let's talk about the process of ES Indexing Documents

A distribution fission activity is more than just a circle of friends!

开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事

Open source 23 things shardingsphere and database mesh have to say

Weekly snapshot of substrate technology 20220411
随机推荐
Design of electronic calculator system based on FPGA (with code)
LeetCode每日一练(主要元素)
Typescript learning materials
FPGA based analog I ² C protocol system design (with main code)
【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
Design of direct spread spectrum communication system based on FPGA (with main code)
Introduction to TTCAN brick moving
Jialichuang EDA professional edition all offline client release
2022年最新《谷粒学院开发教程》:8 - 前台登录功能
Luogu_ P1008 [noip1998 popularization group] triple strike_ enumeration
Problems encountered in vs compilation
Today, Teng Xu came out with 37k during the interview. It's really a miracle. He showed me his skill
Luogu_ P1002 [noip2002 popularization group] crossing the river_ dp
ICML 2022 ぷ the latest fedformer of the Dharma Institute of Afghanistan ⻓ surpasses SOTA in the whole process of time series prediction
Create a database and use
Open source 23 things shardingsphere and database mesh have to say
Vulnerability recurrence ----- 34. Yapi remote command execution vulnerability
Design of CAN bus controller based on FPGA (with main codes)
带你认识图数据库性能和场景测试利器LDBC SNB
【kotlin】第二天