|< < 7 > >|

Phantoms

Preventing phantoms

3) Index locking

  • If the query is implemented by SelectIndex(employee_dept_idx, dept = 'sales'), then we can lock the corresponding B-tree pages.

  • The insert from T2 would have to lock the page for insert.

  • A lock conflict prevents the phantom.

  • But this doesn't work if the query plan does not involve the search of an index.

4) Prevent insertions while the query runs

  • Not quite as bad as locking the entire table, but it's bad.

|< < 7 > >|