Thursday, April 14, 2016

What is concurrency control in database transactions

What is concurrency control in database transactions? Define concurrency control, Why do we need concurrency control schemes? concurrent transactions


Concurrency Control in DBMS


Definition:

The process of executing many different simultaneous (concurrent execution) transactions by complying with ACID properties in a multi-user database system is called as concurrency control.

Why concurrent execution is needed?” is discussed in this post. Please refer.

Discussion:

Executing transactions in serial order, ie., one after the other maintains the integrity of data. All transactions that are executed serially will show a safe, consistent, durable database. But the major disadvantage is the time. Executing individual transactions in serial order consumes lot of time and reduces the transaction throughput. Hence, we need to execute multiple transactions simultaneously.
Assume that you are executing two transactions T1 and T2 simultaneously. Also assume that T1 transfers money from account A to account B and T2 withdraws money from account C. If we execute T1 and T2 simultaneously, the execution will not harm the consistency of the database because both transactions are working on different data items.
Let us suppose T1 transfers money from account A to account B and T2 withdraws money from account B. What would happen if we execute T1 and T2 simultaneously? As both transactions are working (writing) on the same data items (in this case, both T1 and T2 changes the value of data item B), whichever writes later will be the final value of B which is not correct.
From the above discussion we would understand that, the simultaneous transactions have to be handled with extra care to ensure the integrity of the data and the database if they read or write same data items. The process that is used to ensure this type of safe execution of transaction is called concurrency control.

********************









No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery