1. Conservative 2-PL :
- It is also known as Static 2-PL.
- This protocol requires the transaction to lock all the items it access before the transaction begins execution by pre-declaring its read-set and write-set.
- If any of the pre-declared items needed cannot be locked, the transaction does not lock any of the items, instead, it waits until all the items are available for locking.
2. Strict 2-PL :
- The most popular variation of 2-PL is Strict 2-PL.
- It is a lighter version of Rigorous 2-PL.
- This requires that in addition to the lock being 2-Phase all Exclusive(X) Locks held by the transaction be released until after the Transaction Commits.
- Transactions are allowed to release Shared locks before it Commits.
Difference between Conservative and Strict 2-PL :
|S.No.||Conservative 2-PL||Strict 2-PL|
|1.||In Conservative 2-PL, A transaction has to acquire locks on all the data items it requires before the transaction begins it execution.||In Strict 2-PL, A transaction can acquire locks on data items whenever it requires (only in growing phase) during its execution.|
|2.||It does not have growing phase.||It has growing phase.|
|3.||It has shrinking phase.||It has partial shrinking phase.|
|4.||It ensures that the schedule generated would be Serializable and Deadlock-Free.||It ensures that the schedule generated would be Serializable, Recoverable and Cascadeless.|
|5.||It does not ensures Recoverable and Cascadeless schedule.||It does not ensures Deadlock-Free schedule.|
|6.||It does not ensure Strict Schedule.||It ensures that the schedule generated would be Strict.|
|7.||It is less popular as compared to Strict 2-PL.||It is the most popular variation of 2-PL.|
|8.||It is not used in practise.||It is the most popular variation of 2-PL.|
|9.||In Conservative 2-PL, a transaction can read a value of uncommitted transaction.||In Strict 2-PL, a transaction only reads value of committed transaction.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Categories of Two Phase Locking (Strict, Rigorous & Conservative)
- Difference between Conservative and Rigorous 2-PL
- Difference between Yaacomo and and XAP
- Difference between Virtuoso and VoltDB
- Difference between Static and Dynamic SQL
- Difference between Simple and Complex View in SQL
- Difference between AlaSQL and Amazon Neptune
- Difference between Inverted Index and Forward Index
- Difference between OLAP and OLTP in DBMS
- SQL | Difference between functions and stored procedures in PL/SQL
- Difference between Row oriented and Column oriented data stores in DBMS
- Difference between Weaviate and WakandaDB
- Difference between Where and Group By
- Difference between SQL and NoSQL
- Difference between Structured, Semi-structured and Unstructured data
- Difference between Oracle and MongoDB
- Difference between RDBMS and HBase
- Difference between Hive and HBase
- Difference between Primary key and Unique key
- Difference between SQL and PLSQL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.