Atomicity in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

Overview

DBMS is defined as a database management system that manages data and ensures that it remains integrated whenever modifications are made to it. If the integrity of the data is compromised, the entire data set will be disrupted and distorted. As a result, four properties known as the ACID properties are stated in the database management system to ensure the integrity of the data.

What is Atomicity in DBMS?

Let's know what is atomicity in DBMS. The ACID model in database management systems stands for (Atomicity, Consistency, Isolation, and Durability) and is a collection of concepts used to ensure the integrity of transactions in the database. Atomicity is mainly accomplished by complicated processes like journaling or logging, or through operating-system calls.

In a database management system, we can define an atomic transaction as an indivisible as well as irreducible series of database actions in which either everything happens or nothing happens.

An assurance of atomicity avoids incomplete database modifications, which can cause more problems than rejecting the entire series outright. As a result, any other database client cannot witness the transaction in the process. It has not yet occurred at one point in time, while it has already happened in its entirety at another (or no changes happen if the transaction was canceled in progress).

Example of Atomicity

We have already discussed what is atomicity in DBMS. Let's understand the concept of atomicity in a better way with the help of examples.

Example 1) Atomicity in Online Ticket Booking Systems

Let's take the example of an online ticket booking system, a booking may consist of two discrete acts that combine to make a transaction: the first one is the payment for the ticket and then the second is to reserve the seat for the person who just paid. Business logic mandates that these two different and separate actions must take place concurrently. Problems can arise if one occurs without the other. The system, for example, may reserve the same seat for two different consumers.

Example 2) Transactions taking place in a bank (Credit or Debit of Money)

If Marino has an account namely A with $50 in it and wants to send $20 to Amanda who has an account namely B. An amount of $200 is already existing in account B. When $20 is deposited to account B, the total becomes $220.

Two procedures are now scheduled to take place. One is that the $20 that Marino wishes to send will be deducted from his account A and would be credited to account B, i.e., into Amanda's account. What happens now is that the initial debit operation succeeds, but the crediting operation fails.

As a result, the value in Marino's account A becomes 30$, while the value in Amanda's account remains $200 as it was earlier.

Example of Automicity in DBMS

Therefore, this transaction is not an atomic transaction.

Conclusion

  • To maintain atomicity in a database management system, all transactional statements must succeed or fail in every situation, such as power outages, mistakes, as well as crashes.
  • In a money transfer transaction, for example, debiting and crediting must occur concurrently or not at all.
  • The situation or environment in which an atomic transaction is executed determines what defines an atomic transaction.
  • A database system that guarantees to provide atomicity must be able to do so even if the electricity supply or the underlying operating system or software that runs the database fails.
  • To know more about the other acid properties in DBMS, visit here.

Read More: