Inserts and Deletes
DML processing requires creating or deleting physical objects
Neither 2PL nor strict 2PL correctly handles such cases
Phantom Tuple Problem
- Based on sufficient fixed budget, transaction
gives each employee a bonus - As a consequence of a new hire, transaction
adds a new employee who should not receive a bonus - New employee appears as
is executing
- New employee appears as
Resolution
DML requests that modify the database according to the results of a query need larger scale locks
- Lock on entire indices
- Predicate locks on tables
- Coarse grained lock: Exclusive lock on entire table
- Fine grained lock: Lock on tuple or row
- Appropriate lock compatibility rules