Phantom read/update problem

Data System Architecture

About

Phantom problem is a phenomena. A data problem during concurrency update.

In the phantom problem, a transaction accesses a relation more than once with the same predicate in the same transaction, but sees new phantom tuples on re-access that were not seen on the first access.

In other words, a transaction reruns a query returning a set of rows that satisfies a search condition and finds that another committed transaction has inserted additional rows that satisfy the condition.

Example

  • A transaction queries the number of employees.
  • Five minutes later it performs the same query, but now the number has increased by one because another user inserted a record for a new hire.
  • More data satisfies the query criteria than before, but unlike in a fuzzy read the previously read data is unchanged.

Cause

This is because two-phase locking at tuple-level granularity does not prevent the insertion of new tuples into a table. Two-phase locking of tables prevents phantoms, but table-level locking can be restrictive in cases where transactions access only a few tuples via an index.





Discover More
Data System Architecture
Concurrency - Concurrency

Data concurrency means that many thread (that may represents users) can access and modify data at the same time. Data concurrency ensures that users can access data at the same time ...reubenbond/status/662061791497744384/photo/1Reuben...
Data System Architecture
Phenomena - Data problem (Concurrency Problem/ Data Corruption)

Because of a race condition, when several transactions concurrently read from and write to a file, variable or database, the following data problems called phenomena can arise: The isolation...
Data System Architecture
Transaction - Isolation (Level|Degree) - (Locking Level ?)

Very early in the development of the transaction concept (ie lock concept), attempts were made to increase concurrency by providing weaker isolation level than the serialiable one. serializability defines...



Share this page:
Follow us:
Task Runner