Database Management System

⌘K
  1. Home
  2. Docs
  3. Database Management Syste...
  4. Transaction Processing, C...
  5. Serializability

Serializability

Serializability is a technique used in database management that ensures transactions are executed in a way that the final result is the same as if the transactions were executed serially (one after the other), without any overlap.

  • It is one of the key criteria for ensuring the consistency of a database in a multi-user environment.
  • In simpler terms, serializability ensures that even when transactions are executed concurrently (in parallel), the outcome should be the same as if each transaction were executed in sequence.

A serializable schedule is a schedule of transactions (a sequence of operations from multiple transactions) that ensures the system maintains database consistency.

  • In a serializable schedule, the result of executing the transactions concurrently must be the same as if the transactions were executed one at a time, in some sequential order.

There are two main types of serializability:

1.) Conflict Serializability

Conflict serializability is based on the concept of conflicting operations between transactions. Two operations conflict if they access the same data item and at least one of them is a write operation.

  • It deals with detecting whether the instructions are conflicting in any way, and specifying the order in which these two instructions will be executed.

Conflicting operations: Two operations conflict if:

  • They are from different transactions.
  • They operate on the same data item.
  • At least one of the operations is a write.

For example, if Transaction 1 writes to data item X, and Transaction 2 reads or writes to X, then these operations are considered conflicting.

A schedule (a sequence of operations from multiple transactions) is conflict serializable if it can be transformed into a serial schedule (where transactions are executed one at a time) by swapping non-conflicting operations. The schedule must preserve the order of conflicting operations, meaning the final state of the database must be the same as if the transactions were executed sequentially.

Example:
Consider two transactions:

  • T1: Write(X)
  • T2: Read(X)

These two operations conflict because both are accessing X. If T1 and T2 are executed in parallel, their schedule must ensure that the outcome is the same as if they were executed one after the other in some serial order (either T1 before T2 or vice versa).

2.) View Serializability

View serializability is a more general concept than conflict serializability. It ensures that the final result of the concurrent execution of transactions is equivalent to some serial execution, without focusing on conflicting operations but rather on the views of the data presented to the transactions.

    A schedule is view serializable if:

    • The initial read values for a transaction are the same as in some serial schedule.
    • The final write values for each transaction are also the same.
    • The write-read relationship between transactions is maintained.

    View serializability does not require conflicting operations to be serialized in the same way, but it ensures that the final result and the data visible to each transaction are consistent with some serial execution.

    Example:
    If two transactions access the same data in a non-conflicting manner but still produce the same final result as if executed serially, the schedule is view serializable.

    How can we help?

    Leave a Reply

    Your email address will not be published. Required fields are marked *