/    /  DBMS – Transaction  Isolation

Transaction  Isolation

 

Transaction Isolation means, when there are two transitions that are taking place simultaneously, then one transaction should not overlap the other. Each translation should not be aware of the other transactions currently taking place in the system. The database should take care of the control over the concurrent transactions. Transactions use ACID properties for Isolation. 

We will be understanding “Transaction Isolation” with the help of examples.

Take the following transaction.

Transfer an amount of Rupees 50 from Account-A to Account-B.

                     T1  :         read A ;

                                             A = A – 50 ;

                                             write A ;

                                             read B ;

                                             B = B + 50 ;

                                             write B ;

Example-1 :

Consider the T1 transaction from Example-1 :

                     T1  :         read A ;

                                             A = A – 50 ;

                                             write A ;

                                             read B ;

                                             B = B + 50 ;

                                             write B ;

 

Let transaction T2 transfers 10 % of the amount from Account-A to Account-B. 

                     T2  :         read A ;

                                             temp = A * 0.1 ;

                                             A = A – temp ;

                                             write A ;

                                             read B ;

                                             B = B + temp ;

                                             write B ;

 

Schedule’ is a set of transactions to be executed sequentially or concurrently.

Let the current values be

Account-A = 1000  

                         Account-B = 2000

 

Example-2 : Create a Schedule-1 such that transaction T1 is followed by transaction T2.

 

T1T2
read A ;                                A = A – 50 ;                                write A ;                                read B ;                                B = B + 50 ;                                write B ;                                commit 
                                                                        A = A – temp ;                                                                                write A ;                                                                                read B ;                                                                                B = B + temp ;                                                                                write B ;                                                                                commit

 

Here, the values of A and B initially are : 1000   and  2000.

 

AB
Initial Values10002000
After T19502050
After T28552145

Here,   the value of temp = 95.

Also,  before and after Schedule-1,  A + B values are the same

Let’s understand the further concepts in Transaction Isolation using the same example. Refer to the next article for better understanding of transaction Isolation.

 

Reference Link.

Transaction  Isolation