Reputation: 59
I can understand we should avoid dirty read because if we read uncommitted data other transaction may rollback but in Non repeatable and Phantom reads we are reading committed data. If we read committed data what is the problem.
Upvotes: 3
Views: 368
Reputation: 239824
If someone tells you that their name is Steve and then, 6 months later, you meet them again and tell you that their name is Bob, is that a problem? The fact that, between those times, they legally changed their name and that means that the facts have changed may or may not matter to you. But the fact that it can happen is something, at least, to be aware of.
Personally, I don't tend to write code that relies upon repeated querying of the same data inside a single transaction and so don't have any specific situations where non-repeatable reads cause me problems. But I'm aware that they are a possibility. The fact that the data has been committed (as with my name change analogy above, where at both times, the name given was the fully-committed to name of the entity we were talking to) doesn't mean it can't change.
Upvotes: 1