ACID PROPERTIES OF RELATIONAL DATABASE SYSTEM

If you have studied a bit about RDBMS (Relational Database Management System), you may have heard of ACID properties. If you already know what the ACID properties are and what they do, then “Congratulations”, you do not need to read this post, there is nothing new I shall offer to you. But if you have heard about ACID properties but did not look deep to find out what they are, or the term “ACID properties” is new to you, then hang on a little, let’s discuss about this a little.

Before going into ACID properties, let’s define what a database transaction is, as we shall use the term “transaction” again and again in our discussion. A database transaction can be a task or a group of task which is the smallest operational unit. A task is the minimal processing unit which cannot be subdivided any further. For example, let’s say we have a database consisting user’s bank accounts. If user A sends $50 to user B, then this operational unit is a database transaction. But this transaction contains a group of tasks:

Open account (A)
A.balance = A.balance - 50
Close account (A)
Open account (B)
B.balance = B.balance + 50
Close account (B)

Now that we have understood what a database transaction is, let’s proceed to ACID properties. ACID stands for Atomicity, Consistency, Isolation and Durability.

Atomicity: Atomicity of database means, the database system ensures that, either a transaction will take place completely or no part of the transaction will take place. If a transaction can be broken into several tasks, then either all of the tasks will complete or none of the tasks will take place. If we consider database states, then there will be no database state where part of the transaction has taken place and part of it did not.

Consistency: Consistency means database system will maintain a stable state after performing a transaction. If the database system was in a stable state before a transaction, then after the transaction is taken place, then the database will still be in a stable state. No transaction will have any adverse effect on the existing data in the database.

Isolation: If there are several transactions takes place in the database system at the same time, then each one will have the result same as if it were the only transaction that took place at the time. A running transaction will have no effect on another transaction that is also running at the same time. One common way to maintain isolation is to lock a table or row on which a transaction has affect.

Durability: Durability of database system ensures that the existing data in the database will survive in case of system failure. In case a transaction has completed and then the system shuts down somehow, when it restarts, the transaction will still be stored in the database. If the system fails as soon as a transaction is committed and before the data is written in the disk, when the system recovers, database engine has to write the committed data to the disk.

Leave a Reply

Your email address will not be published. Required fields are marked *