DEV Community

Cover image for What is ACID Transaction? ELI5
Christian Dave Montalban
Christian Dave Montalban

Posted on

What is ACID Transaction? ELI5

ACID transactions are a way of organizing actions in a computer so that they are correct and consistent. ACID stands for Atomicity, Consistency, Isolation, and Durability, and it helps to ensure that actions are completed successfully, and that the data in the computer is accurate and reliable.

Imagine you are playing a game of basketball with your friends. You are all working together to score as many points as possible, and you are taking turns shooting the ball into the hoop. Without ACID transactions, it would be difficult to keep track of who scored which points, and to make sure that the score is accurate and fair. But with ACID transactions, you can use special rules and procedures to organize the game and keep track of the score.

For example, let's say you are playing a game with three friends, and you are using a scoreboard to keep track of the score. With ACID transactions, you can use the following rules to ensure that the game is played correctly and consistently:

Atomicity: Each shot is an atomic action, which means that it is completed successfully or not at all. This means that if someone shoots the ball and misses, the shot is not counted, and the ball is passed to the next person.

Consistency: The game is played according to a set of rules, which ensures that the score is calculated correctly and consistently. This means that if someone shoots the ball and makes it, the correct number of points is added to their score.

Isolation: Each person takes their turn independently, without interference from the other players. This means that when one person is shooting the ball, the other players cannot touch the ball or interfere with the shot.

Durability: The score is recorded on the scoreboard, and it is not lost or erased. This means that even if the game is interrupted or the scoreboard is reset, the score is preserved and can be used to determine the winner of the game.

Overall, ACID transactions are a helpful way of organizing actions in a computer, just like the rules and procedures of a game help to ensure that the game is played correctly and consistently.

Top comments (0)