|< < 6 > >|

Phantoms

Preventing phantoms

How can we prevent the insertion of rows that would be retrieved (and locked) if they existed before the insertion?!?!

1) Lock the table

  • Unacceptable.

  • Restricts concurrency far too much.

2) Predicate locking

  • Place a lock on the predicate that identifies records of interest: dept = 'sales'.

  • The insert of a row with dept = 'sales' conflicts.

  • Hasn't been used. Unclear why.

|< < 6 > >|