week 10
10.5 Transaction Isolation Levels
SQL defines four standard isolation levels, representing trade-offs between consistency and concurrency:
|
Isolation Level |
Concurrency Problems Prevented |
Nigerian Bank Use Case |
|
READ UNCOMMITTED |
None (allows all problems) |
Almost never used in banking — too risky |
|
READ COMMITTED |
Prevents Dirty Reads |
Default in Oracle, PostgreSQL. Used for routine banking queries where slight inconsistency is acceptable. |
|
REPEATABLE READ |
Prevents Dirty Reads + Non-Repeatable Reads |
Default in MySQL InnoDB. Good for financial reporting within a transaction. |
|
SERIALIZABLE |
Prevents ALL problems (full isolation) |
Used for critical financial operations: salary payments, regulatory reporting, inter-bank transfers. |
SQL: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;