|< < 5 > >|

Phantoms

Locking, by itself, does not prevent phantoms:

  • T1 locks all of the rows in employee with dept = 'sales'.

  • T2 does not encounter any of these locks, because it is inserting a new row.

  • So T2 proceeds to commit.

  • T1 sees the new row on the second execution of the query.

This is acceptable for READ COMMITTED and REPEATABLE READ isolation, but not SERIALIZABLE.

|< < 5 > >|