Avoiding Phantoms - Predicate Locks
Suppose a query reads all records satisfying predicate P. For example,
- Select * From Accounts Where Location = “Tacoma”
- Normally would hash each record id to an integer lock id
- And lock control structures. Too coarse grained.
Ideally, set a read lock on P
- which conflicts with a write lock Q if some record can satisfy (P and Q)
For arbitrary predicates, this is too slow to check
- Not within a few hundred instructions, anyway