What are transaction isolation levels and which anomalies do they allow?
What are transaction isolation levels and which anomalies do they allow?
Isolation levels define how much concurrent transactions can see of each other. Higher isolation prevents more anomalies but reduces concurrency.
| Anomaly | What happens |
|---|---|
| Dirty read | read data another transaction has not committed |
| Non-repeatable read | the same row read twice gives different values (someone committed an update) |
| Phantom read | the same query returns a different set of rows (someone inserted or deleted matching rows) |
| Lost update | two transactions read then write the same row; one write overwrites the other |
| Write skew | two transactions read overlapping data, then update different rows, breaking a rule that spans both (two doctors both go off call) |
| Level | Dirty read | Non-repeatable | Phantom |
|---|---|---|---|
READ UNCOMMITTED |
possible | possible | possible |
READ COMMITTED |
no | possible | possible |
REPEATABLE READ |
no | no | possible per standard |
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.