Recent Post

Transactions

Transaction Properties (ACID)
 Atomicity :- Atomicity means executes all the operation or none of them.
 Consistency :- It is a database should be consistent before and after the execution of the transaction.
 Isolation :- Concurrent execution of two or more transaction.
 Durability :- After commit, effect of transaction should persist.

Schedules
     Sequence that indicates the chronological order in which instruction of concurrent transaction are executed.

Serial Schedule
     After commit of one transaction begins another transaction.
     Number of possible serial schedules with n transaction is n!.
     No consistency

Concurrent Schedule
     Simultaneous execution of two or more transaction.
     may result inconsistency.
     Better throughput and less response time.
     To maintain consistency should satisfy ACID property.

Conflicts in concurrent Execution
   WR Problem:-

RW problem:-




WW problem:-




Classification of schedule based on Serializability
  Serializability:- A schedule is serialisable if it is equivalent to a serial schedule.
     (i) Conflict serialisability
     (ii) View serialisability


Conflict serialisability:- Instruction Ii and Ij of transactions Ti and Tj respectively, conflict if and only if there exists some item Q accessed by both Ii and Ij and at least one of these instructions wrote Q.
 (i) Ii = read (Q) , Ii = read (Q). Ii and Ij don't conflict.
 (ii) Ii = read (Q) , Ii = write (Q). They conflict.
 (iii) Ii = write (Q) , Ii = read (Q). They conflict.
 (iv)  Ii = write (Q) , Ii = write (Q). They conflict.

Conflict equivalent:- If a schedules S can be transformed into a schedules S' by a series of swaps of non-conflicting instruction, we say that S and S' are called conflict equivalent.

Conflict serialisable:- We say that a schedules S is conflict serialisable if it is conflict equivalent to a serial schedule.

View serialisable:- Let S and S' be two schedules with the same set of transaction. S and S' are view equivalent if the following three conditions are met:
    (i) For each data item Q, if transaction Ti reads the initial value of Q in schedules S, then transaction Tj must, in schedules S', read the initial value of Q.
    (ii) For each data item Q if transaction Tj executes read (Q) in schedule S, and that value was produced by transaction Tj (if any), then transaction Tj must in schedules S' also read the value of Q that was produced by transaction Tj.
    (iii) For each data item Q, the transaction (if any) that performs the final write(Q) operation in schedules S must performs the final write(Q) operation in schedule S'

Remember:- --------------------------------------------------------------------------------------
  Every conflict serialisable schedule is also view serialisable.
  Every view serialisable schedule that is not conflict serialisable has blind writes.
-------------------------------------------------------------------------------------------------------


Irrecoverable Schedule :- Its not possible to roll back after the commitment of a transaction as the initial data is no where.
  Example:


Recoverable Schedule:- A schedule is recoverable if a transaction Tj reads a data items previously written by transaction Ti the commit operation of Ti appears before the read operation of Tj. 
Example:


Cascadeless Recoverable Schedules:- For each pair of transaction Ti and Tj such that Tj reads a data item previously written by Ti the commit operation of Tj appears of Ti appears before the read operation of Tj. Every cascadeless schedules is also recoverable.
  Example:
Cascading rollback: A single transaction failure leads to a series of transaction rollbacks.

Strict Recoverable Schedules:- It transaction Ti updates the data item A, any other transaction Tj not allowed to R(A) or W(A) until commit or roll back of Ti.
 Example:



No comments