A set of transactions is serializable if the set produces the same result as an arbitrary serial execution of those transactions for arbitrary input.
A set of transactions is correct only if it is serializable. The Two-Phase Locking (2PL) protocol ensures the serializability of transactions.
The following table describes the phases of the Two-Phase Locking protocol:
Phase | Description |
---|---|
Growing | Acquires lock on object before operating on it. The Optimizer requests locks as close to the beginning of the transaction as possible. |
Shrinking | Releases previously acquired lock and acquires no more locks. Lock release is an all-or-none operation. Acquired locks are not released until transaction is committed or rolled back. |