229k views
3 votes
A transaction T1 may read a set of rows from a table, perhaps based on some condition specified in the SQL WHERE clause. Now suppose that a transaction T2 inserts a new row that also satisfies the WHERE clause condition of T1, into the table used by T1. If T1 is repeated, then T1 will see a row that previously did not exist, called a phantom. What is the term used to describe this phenomenon?

1) Phantom read
2) Dirty read
3) Lost update
4) Unrepeatable read

User Egal
by
7.9k points

1 Answer

2 votes

Final answer:

The term used to describe the phenomenon where a transaction sees new data on a repeat read because another concurrent transaction has added data that meets the original transaction's query criteria is called a 'phantom read'.

Step-by-step explanation:

The phenomenon where a transaction T1 reads a set of rows, and then a subsequent transaction T2 inserts a new row that satisfies the condition of T1, causing T1 to see new data upon repetition, is known as a phantom read. This is one of the phenomena that can occur in the context of database transactions and isolation levels. Specifically, a phantom read happens when a transaction re-executes a query expecting the same set of rows, but finds additional rows because another transaction has committed a change that satisfies the query's condition.

Isolation levels in databases are used to control how transaction data is visible to other transactions. Phantom reads, dirty reads, lost updates, and unrepeatable reads are all issues related to transaction isolation that database management systems aim to manage.

In this scenario, where T1 encounters new rows on a repeat read, the term that best describes this phenomenon is phantom read, which is the correct answer to your question: 1) Phantom read.

User Kees De Kooter
by
7.7k points