Reputation: 13558
What happens when I have a Read Committed isolation level set and a phantom read is made in my transaction. Does it get rolled-back and re-run or just rolled-back?
Upvotes: 1
Views: 1149
Reputation: 755084
Unless my understanding of Committed Read isolation is wonky (always a possibility), then the whole point of Committed Read is that you cannot see Phantom Rows - rows that were changed by another transaction but the change was never committed and later rolled back. So, at the application level, with Committed Read isolation, the application cannot see phantoms.
What the DBMS does internally depends on the DBMS. In a MVCC system, your transaction will simply read the version committed at the time your transaction started. In a locking system, you might hit the other transaction's lock, and then your own might skip or block. However, AFAIK, the DBMS does not roll back your transaction because of the problem.
Upvotes: 2
Reputation: 747
You might see stale data (only if on the second read, that row was in that table with updated columns). To spare yourself from such things making your data go bad, use optimistic locking.
Upvotes: 0
Reputation: 96454
No, it doesn't cause anything to get rolled back. What happens is your code sees bad data, and probably makes bad decisions based on that, that's all.
Upvotes: 1