Basics of ACID properties:


Before understanding ACID properties one should know the basic concept of a transaction.

Atomicity Consistency Isolation DurabilityIn simple terms transaction is a set of instructions to perform some logical task. For example we can write a transaction to perform a money transfer between two bank accounts. Now this activity involves a set of instructions like money debit and credit. On a whole these activities forms a transaction that is responsible for money transfer between two bank accounts.

Now coming to The ACID properties, it is a set of properties to protect database validity in all odds like the event of errors, power failures, concurrency control, etc. In other words if a sequence of database operations that satisfies the ACID properties (and these can be perceived as a single logical operation on the data) is called a transaction.

ACID is an acronym for atomicity, consistency, isolation, and durability.

Atomicity


Atomicity of a transaction means series of database operations consisting of the transaction either all occur, or nothing occurs. It prevents partial transactions to occur, which can cause greater problems in database consistency.

Consistency


database users define many rules as per the requirements and database consistency is the property that ensures that it should remain consistent after every transaction i.e the transaction didn't break the rules defined by the program. Database consistency is important because it preserves the rules defined by the program by accepting or rejecting the incoming data.

Consistency rules are often enforced through constraints at a field level. A constraint specifies a rule governing a given record or field-level value. For example if there is a minimum balance requirement for a savings account then one cannot withdraw an amount which will make the balance less than the minimum balance(So here we are rejecting the request of subtracting the balance amount).


Isolation


If multiple transactions are running concurrently, they should not be affected by each other. If they affect each other in that case we can get an unpredictable result. Isolation ensures that all transactions running concurrently are running in an isolated manner. A lower isolation level increases the ability of many users to access the same data at the same time but increases the number of concurrency effects (such as dirty reads or lost updates) users might encounter. Conversely, a higher isolation level reduces the types of concurrency effects that users may encounter, but requires more system resources and increases the chances that one transaction will block another. Isolation is implemented by locking and database schedules.

Durability


This ensures that the transaction committed to the database will not be lost in case of any hardware or software failures. Durability implemented through transaction logs and database backups. These back-ups and logs can be used to restore the state of the database in case of some failures.