Mastering DBMS: Learn Basics to Advanced Technique
ACID Properties in DBMS with examples
What are ACID Properties in DBMS?
Database Management System (DBMS) provides an efficient way to fetch, store, manipulate and analyze data. The primary job of DBMS is to store the data in such a way that it should remain consistent whenever a modification is done in the database by authorized users.
This consistency is maintained through four properties which are called ACID Properties in DBMS. These properties have their utility in the transaction process that occurs during accessing the data. It’s important to know the term ‘transaction’ before learning about the ACID Properties of DBMS.
A Transaction is a single unit of work that is done to access and modify the data in the database using read-and-write operations. In other words, a transaction is a set of logically related operations that are performed by a single user to modify the data.
Whenever the transaction process occurs, it is important to maintain data consistency and integrity throughout the process. Therefore, ACID Properties in DBMS have crucial importance to achieve this goal. The word ‘ACID’ stands for Atomicity, Consistency, Isolation, and Durability, which are summarized in the below diagram. In this article, we will learn each of these in detail.
Atomicity
The term Atomicity means that the data should remain Atomic during the entire transaction process. It means that either the process should be completed or should not occur at all. Let’s understand this using an example. Suppose you have a task to fill a water bottle. If the process of filling water has to be atomic, you will have only two options. You can either fill the bottle completely or not fill even a single drop of water.
You cannot fill the bottle half or three-fourths. This is the simple meaning of Atomicity in DBMS. A transaction can be completed in one go or cannot occur at all. There is nothing like a partial transaction in DBMS.
Atomicity has two major operations in DBMS:
- Abort: If a transaction is aborted, the changes in the database are not visible.
- Commit: Commit is used to permanently save the changes made during the transaction in DBMS.
Consistency
Consistency means the Integrity Constraints must be maintained appropriately so that the data remains consistent before and after the transaction. The term Consistency of ACID Properties in DBMS simply emphasizes preserving the data before and after the transaction process.
For example, if you have Rs. 1,000 and you purchase a product worth Rs. 200 then, the remaining amount is Rs. 800 and the seller gets Rs. 200. But, you sum up the total money before and after the transaction process, its total sum is Rs. 1,000. Thus, data consistency is maintained during the transaction process.
Isolation
Isolation means multiple transactions can occur simultaneously without affecting each other. In simple words, Isolation refers to consistency in data among concurrent transactions occurring in the database. It aims to assure that no data should affect another one when multiple transaction processes are going on.
Suppose you and your friend purchase an item at the same time. When you proceed with online payment, you are able to do so as if there is no other transaction happening. But, in reality, your friend’s payment has been done at the same time. Thus, Isolation determines how the changes made during one transaction are to other transactions in the database.
Durability
Durability is one of the important ACID Properties in DBMS as it assures that the data should remain permanent in the database after successful transaction operations. This is important because if the system suffers from a failure, the data should remain intact so that it can be accessed.
This is the reason why databases can survive even if the system crashes or suffers from failure. To assure Durability, the changes made in the data should be committed every time in the database. This will maintain the Durability of the data in the database.
This is how ACID Properties in DBMS assure data integrity during the whole transaction process. These properties are prerequisites for studying Transaction Processing and Concurrency Control in DBMS,