Condition of schedules to View-equivalent


View-equivalence is a term used in database management systems to describe the circumstance in which two schedules, when applied to the same database, yield the same result set. This requirement is necessary to guarantee data correctness and consistency in database applications.

There are requirements that schedules must meet in order to achieve view equality. These circumstances are −

  • Conflict Serializability − The conflicting operations in a schedule must be performed in the same sequence for it to be conflict serializable. Operations that access the same data item and at least one of which affects the data are said to be in conflict

  • Consistent Transactions − The ACID properties—Atomicity, Consistency, Isolation, and Durability—must be met for transactions to be consistent, which implies they must be reliable.

  • Correctness of Views − The views generated by the schedules must be accurate, i.e., they must yield the same set of results as the original database

Examples of Schedules that are View-Equivalent

Example 1: Consider the following two schedules −

Schedule 1:
T1: Read(A); Write(B);
T2: Read(B); Write(A);

Schedule 2:
T1: Read(B); Write(A);
T2: Read(A); Write(B);

Both of these schedules are conflict serializable, consistent, and produce the same result set. Therefore, they are view-equivalent.

Example 2:Consider the following two schedules −

Schedule 1:
T1: Read(A); Write(A);
T2: Read(B); Write(B);

Schedule 2:
T1: Read(B); Write(B);
T2: Read(A); Write(A);

Even if each schedule has distinct data items, the procedures nevertheless provide the same results. These are also equivalent from a perspective point of view.

Example 3:Consider the following two schedules −

Schedule 1:
T1: Read(A); Read(B);
T2: Write(B); Write(A);

Schedule 2:
T1: Read(B); Read(A);
T2: Write(A); Write(b);

Each schedule's procedures provide the same results even when they are applied to distinct data items. They share the same vision, so to speak.

Examples of Schedules that are not View-Equivalent

Example 1: Consider the following two schedules −

Schedule 1:
T1: Read(A); Write(B);
T2: Read(B); Write(C);

Schedule 2:
T1: Read(B); Write(C);
T2: Read(A); Write(B);

These schedules are not conflict serializable, as they have different orders of conflicting operations. Therefore, they are not view-equivalent.

Example 2: Consider the following two schedules −

Schedule 1:
T1: Write(A); Read(A);
T2: Write(B); Read(B);

Schedule 2:
T1: Write(B); Read(B);
T2: Write(A); Read(A);

In S1, transaction T1 writes to A before transaction T2 reads A, while in S2, transaction T2 writes to B before transaction T1 reads B. Thus, S1 and S2 are not view-equivalent.

Example 3: Consider the following two schedules −

Schedule 1:
T1: Write(A); Read(A);
T2: Write(B); Read(B);

Schedule 2:
T1: Write(B); Write(A);
T2: Read(B); Read(A);

In S1, transaction T1 writes to A before transaction T2 reads A, while in S2, transaction T2 writes to B before transaction T1 writes to A. Thus, S1 and S2 are not view-equivalent.

Conclusion

View-equivalence is a fundamental concept in database management systems since it ensures the accuracy and consistency of data. For schedules to achieve view equivalence, they must satisfy a variety of criteria, including conflict serializability, consistent transactions, and correctness of views. By understanding these situations, programmers may construct schedules that are view-equivalent, ensuring the dependability and accuracy of their database programs.

Updated on: 07-Sep-2023

180 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements