![]() |
VOOZH | about |
In DBMS, serializability ensures the database remains correct even when multiple transactions run at the same time. It makes transactions behave as if they were executed one after another in some order. This prevents conflicts, maintains data consistency, and ensures reliable results, just like in a single, orderly sequence of transactions.
A non-serial schedule allows transactions to run concurrently and may access the same data. To ensure database consistency, it must be serializable, meaning it should produce the same result as some serial (one-by-one) execution.
Transaction-1 | Transaction-2 |
|---|---|
R(a) | |
W(a) | |
R(b) | |
W(b) | |
R(b) | |
R(a) | |
W(b) | |
W(a) |
We can observe that Transaction-2 begins its execution before Transaction-1 is finished, and they are both working on the same data, i.e., "a" and "b", interchangeably. Where "R"-Read, "W"-Write
We can utilize the Serialization Graph or Precedence Graph to examine a schedule's serializability. A schedule's full transactions are organized into a Directed Graph, what a serialization graph is.
It can be described as a Graph G(V, E) with vertices V = "V1, V2, V3,..., Vn" and directed edges E = "E1, E2, E3,..., En". One of the two operations—READ or WRITE—performed by a certain transaction is contained in the collection of edges. Where Ti -> Tj, means Transaction-Ti is either performing read or write before the transaction-Tj.
There are two ways to check whether any non-serial schedule is serializable.
Conflict serializability ensures database consistency by checking if a non-serial schedule can be rearranged into a serial order by swapping non-conflicting operations. It prevents conflicting operations (like read/write on the same data) from executing at the same time.
For two schedules (S1 and S2) to be conflict equivalent, they must satisfy the following:
In simple terms, conflict equivalency ensures that conflicting operations happen in the same order in both schedules, while non-conflicting ones can appear in any order.
View serializability ensures that a non-serial schedule results in the same final outcome as a serial schedule, maintaining database consistency.
To further understand view serializability in DBMS, we need to understand the schedules S1 and S2. The two transactions T1 and T2 should be used to establish these two schedules. Each schedule must follow the three transactions in order to retain the equivalent of the transaction. These three circumstances are listed below.
Schedules (S1 and S2) must satisfy these two requirements in order to be view equivalent:
Example: We have a schedule "S" with two concurrently running transactions, "t1" and "t2."
Schedule S:
Transaction-1 (t1) | Transaction-2 (t2) |
|---|---|
R(a) | |
W(a) | |
R(a) | |
W(a) | |
R(b) | |
W(b) | |
R(b) | |
W(b) |
By switching between both transactions' mid-read-write operations, let's create its view equivalent schedule (S').
Schedule S':
Transaction-1 (t1) | Transaction-2 (t2) |
|---|---|
R(a) | |
W(a) | |
R(b) | |
W(b) | |
R(a) | |
W(a) | |
R(b) | |
W(b) |
It is a view serializable schedule since a view similar schedule is conceivable.
Note: A conflict serializable schedule is always viewed as serializable, but vice versa is not always true.