Before we delve into the discussion of Transaction and Concurrency Control, let’s understand its context.
In today’s times when most of the work is done on computers there are certain questions which need to be answered. Like, where does all the data we put in go? Where does all the data come from? How this data is being handled at the backend in order to get the correct information that we need?
Imagine that you are booking tickets for movies online. Many users can book the tickets online at that very same time. Some users might at that very time cancel the tickets they have booked earlier. Since the load of such systems is of a great extent, so there must be a technique to manage these transactions. The reason of managing transactions is that the users must always get the updated information about the availability of tickets.
So, in order to have correct and consistent information to and from the database, the concept used in DBMS is known as Transaction and Concurrency Control.
Transaction – What it is?
A transaction in DBMS can be defined as a program which collects various operations to be performed on the database (maybe by same or different users) and executes this collection as a single unit.
The term transaction is usually used in context with online systems.
Online systems include:
- Systems used in reservations like rail or air reservations
- Stock Markets
- Movie Tickets Booking
- Supermarket Checkouts, and many more similar systems
In such systems many concurrent users use the database to transact concurrently. Hence Transaction Management and Concurrency Control are essential concepts in DBMS.
Concurrency – Basics
When data from the same database is being shared by multiple users at the same time, this situation is known as concurrency in DBMS.
When data is being shared among users, special care needs to be taken when data is either being added to the database or updated in the database or deleted from the database in the same time slot. If care is not taken then this would lead to either loss of useful data or inconsistency in tuple data.
So, the techniques used to control such situations are Concurrency Control Techniques of DBMS. We would study about these techniques in detail in further posts.
Need of Transaction and Concurrency Control in DBMS
The basic need to create a database is to allow multiple users to access the data and allow them to view or modify the same.
Concurrent users do not pose a problem to the database till they are using it to view the data. The situation becomes challenging when multiple users try to access and change or delete the data present in the database simultaneously.
So, the method used to facilitate multiple users to access shared data simultaneously from the database is handled using Transaction and Concurrency Control Techniques.
These techniques would eliminate the problems caused due to simultaneous access and would resolve the inconsistencies being caused by the same.