ACID Properties In Database Transactions
Learn about the ACID Properties in Database Transactions. Find out what is Atomicity, Consistency, Isolation and Durability with the help of examples.

Table of Contents

Database transaction
A simple example of a transaction
What happens when a transaction fails while executing?
The need for concurrency in transactions
Different states of Transactions
What is ACID?
Familiarization with ACID
Atomicity
Consistency
Isolation
Durability
Database transaction
A database transaction, by definition “is a unit of work performed within a database management system or a similar system, against a database which is treated coherently and reliably, independent of other transactions.” The transaction is generally a change within the database, and it can be any change. The two primary purposes of transactions in the database management system are listed below:

There is a need to isolate the programs which are accessing the database concurrently. If this does not happen, the outcomes of these programs can be error-prone. The database transaction provides isolation to these programs which are involved in accessing the database concurrently.
As we know, the systems are prone to different kinds of failures like a partial or complete seizure of execution, incomplete operations of the database etc. The transaction helps to provide dependable units of work which have the ability to allow correct recovery from these failures.
This single unit of logical work, a transaction can sometimes be composed of more than one operation. This generally happens in the case of the Database Management System. Here, in a database management system, the transaction is any logical calculation which is done in a consistent mode in the database. One of the examples of this kind of transaction is when you transfer money of $1000 from your bank account to your friend’s bank account. To conclude the transaction, the system first subtracts the $1000 from your account. Then the system adds up $1000 to your friend’s account.

The transaction in a database, by definition, should have the following properties:

Atomicity: The Transaction must either complete in as a whole or have no change at all.
Consistency: The Transaction must obey to the existing constraints in the database.
Isolation: The current Transaction must not influence other transactions.
Durability: This Transaction must get written to persistent storage.
These terms together are referred to as ACID properties and are imperative in database transactions. We will discuss these properties in detail in the latter part of this article.

It is worth noting that the transaction programs can either change or not change the contents of the database. It totally depends on the type of transaction and of course, the database. But one thing is sure about a transaction that is; it will always run as a single unit under any circumstances. If successful, these transactions can change the database from one consistent state to some another consistent state.

#computing #dbms #acid properties #database

ACID Properties in Database Transactions - WTMatter
4.00 GEEK