0% completed
OCC assumes that conflicts are rare and allows transactions to execute without restrictions until they are ready to commit. At the commit stage, the system checks for conflicts.
PCC assumes that conflicts are likely and prevents them by acquiring locks on data as soon as a transaction accesses it.
Aspect | Optimistic Concurrency Control (OCC) | Pessimistic Concurrency Control (PCC) |
---|---|---|
Assumption | Conflicts are rare | Conflicts are frequent |
Locks | No locks used | Locks are used |
Performance | High in low-contention scenarios | High in high-contention scenarios |
Rollback | Rollbacks occur if conflicts are detected | No rollbacks due to conflicts |
Overhead | Low locking overhead | High locking overhead |
Use Case | Read-heavy or low-contention workloads | Write-heavy or high-contention workloads |
Criteria | Use OCC | Use PCC |
---|---|---|
System Contention | Low contention | High contention |
Transaction Type | Read-heavy | Write-heavy |
Failure Tolerance | High (rollbacks acceptable) | Low (strict consistency required) |
System Type | Distributed systems or systems with low conflicts | Centralized systems with frequent conflicts |
.....
.....
.....