In this article, we are going to explain the serializability concept and how this concept affects the DBMS deeply, we also understand the concept of serializability with some examples, and we will finally conclude this topic with an example of the importance of serializability. The DBMS form is the foundation of the most modern applications, and when we design the form properly, it provides high-performance and relative storage solutions to our application.
If a non-serial schedule can be transformed into its corresponding serial schedule, it is said to be serializable. Simply said, a non-serial schedule is referred to as a serializable schedule if it yields the same results as a serial timetable.
A schedule where the transactions are overlapping or switching places. As they are used to carry out actual database operations, multiple transactions are running at once. It’s possible that these transactions are focusing on the same data set. Therefore, it is crucial that non-serial schedules can be serialized in order for our database to be consistent both before and after the transactions are executed.
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.
Types of Serializability – Conflict & View
Conflict serializability refers to a subset of serializability that focuses on maintaining the consistency of a database while ensuring that identical data items are executed in an order. In a DBMS each transaction has a value and all the transactions, in the database rely on this uniqueness. This uniqueness ensures that no two operations with the conflict value can occur simultaneously.
For example lets consider an order table and a customer table as two instances. Each order is associated with one customer even though a single client may place orders. However there are restrictions for achieving conflict serializability in the database. Here are a few of them.
Three transactions—t1, t2, and t3—are active on a schedule “S” at once. Let’s create a graph of precedence.
Transaction – 1 (t1)
Transaction – 2 (t2)
Transaction – 3 (t3)
It is a conflict serializable schedule as well as a serial schedule because the graph (a DAG) has no loops. We can also determine the order of transactions because it is a serial schedule.
DAG of transactions
As there is no incoming edge on Transaction 1, Transaction 1 will be executed first. T3 will run second because it only depends on T1. Due to its dependence on both T1 and T3, t2 will finally be executed.
Therefore, the serial schedule’s equivalent order is: t1 –> t3 –> t2
Note: A schedule is unquestionably consistent if it is conflicting serializable. A non-conflicting serializable schedule, on the other hand, might or might not be serial. We employ the idea of View Serializability to further examine its serial behavior.
View serializability is a kind of operation in a serializable in which each transaction should provide some results, and these outcomes are the output of properly sequentially executing the data item. The view serializability, in contrast to conflict serialized, is concerned with avoiding database inconsistency. The view serializability feature of DBMS enables users to see databases in contradictory ways.
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 viewed as equivalent:
View Serializability refers to the process of determining whether a schedule’s views are equivalent.
We have a schedule “S” with two concurrently running transactions , “t1” and “t2.”
Schedule – S: