트랜잭션 격리 수준 (Transaction Isolation Levels)

트랜잭션 내 작업이 다른 사람이 수정한 데이터를 관찰하는 방식을 규제하여 데이터 무결성과 시스템 동시성의 균형을 맞춥니다.

격리 수준은 동시 실행 트랜잭션의 상호 작용을 관리합니다. 4가지 ANSI 표준 수준은 READ UNCOMMITTED(더티 리드 허용), READ COMMITTED(더티 리드 방지), REPEATABLE READ(반복 읽기 보장), SERIALIZABLE(직렬화 가능)입니다. 각 수준은 동시성과 데이터 일관성 간의 트레이드오프를 가집니다. MVCC 기반 시스템은 스냅샷을 사용하여 비차단 읽기를 제공합니다.

        graph LR
  Center["트랜잭션 격리 수준 (Transaction Isolation Levels)"]:::main
  Rel_transaction["transaction"]:::related -.-> Center
  click Rel_transaction "/terms/transaction"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧒 5살도 이해할 수 있게 설명

Generated ELI5 content

🤓 Expert Deep Dive

Generated expert content

❓ 자주 묻는 질문

What is a dirty read?

Reading data that has been modified but not yet committed by another transaction.

What is a non-repeatable read?

Reading the same data twice within a single transaction yields different results because another transaction committed changes in between.

What is a phantom read?

A new row matching a query appears in subsequent reads within the same transaction, due to inserts by other transactions.

Which isolation level prevents dirty reads?

READ COMMITTED or SERIALIZABLE (and REPEATABLE READ) prevent dirty reads.

How should I choose an isolation level?

Base the choice on the required balance between correctness guarantees and concurrency, adjusting per operation, and consider MVCC or locking behavior of your DBMS.

📚 출처