Database Management System: Unit III: Transactions

Validation and Snapshot Isolation

Transactions - Database Management System

The optimistic concurrency control algorithm is basically a validation based protocol.

Validation and Snapshot Isolation

Validation Based Protocol

The optimistic concurrency control algorithm is basically a validation based protocol.

It works in three phases -

   • Read phase:

       • In this phase, transaction T is read.

       • The values of various data items are read and stored in temporary variables.

       • All the operations are then performed on temporary variables without updating the actual database.

  • Validation phase :

       • In this phase, the temporary variable value is validated against the actual data in the database and it checked whether the transaction T follows serializability or not.

  • Write phase

     • If the transaction T is validated then only the temporary results are written to database, otherwise the system rolls back.

Each phase has following different timestamps

    • Start (Ti):

       • It contains the timestamp when Ti starts the execution.

    • Validation (Ti):

     • It contains the timestamp when transaction Ti finishes the read phase and starts its validation phase.

  • Finish (Ti):

      • It contains the timestamp when transaction T, finishes its write phase.

With the help of timestamp in validation phase, this protocol determines if the transaction will commit or rollback. Hence

TS (Ti) = validation (Ti).

The serializability is determined at the validation process, it can't be determined in advance

While executing the transactions, this protocol gives greater degree of concurrency when there are less number of conflicts. That is because the serializability order is not pre-decided (validated and then executed) and relatively less transaction will have to be rolled back.

Snapshot Isolation

The snapshot isolation is a multi-version concurrency control technique.

In snapshot isolation, we can imagine that each transaction is given its own version, or snapshot, of the database when it begins. It reads data from this private version and is thus isolated from the updates made by other transactions.

If the transaction updates the database, that update appears only in its own version, not in the actual database itself.

Information about these updates is saved so that the updates can be applied to the "real" database if the transaction commits.

When a transaction T enters the partially committed state, it then proceeds to the committed state only if no other concurrent transaction has modified data that T intends to update. Transactions that, as a result, cannot commit abort instead.

Snapshot isolation ensures that attempts to read data never need to wait.

Database Management System: Unit III: Transactions : Tag: : Transactions - Database Management System - Validation and Snapshot Isolation