익명 사용자
로그인하지 않음
토론
기여
계정 만들기
로그인
IT 위키
검색
Multiversion Concurrency Control
편집하기
IT 위키
이름공간
문서
토론
더 보기
더 보기
문서 행위
읽기
편집
원본 편집
역사
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
'''Multiversion Concurrency Control (MVCC)''' is a concurrency control method used in database systems that allows multiple versions of a data item to exist simultaneously. It ensures consistent reads without locking and provides high concurrency by maintaining transaction isolation. ==Key Concepts== *'''Data Versioning:''' MVCC creates a new version of a data item for every write operation, enabling transactions to access consistent snapshots. *'''Timestamps:''' Each transaction and data version is associated with timestamps, which determine visibility and consistency. *'''Read and Write Operations:''' **Reads access the latest version of data visible to the transaction, avoiding conflicts. **Writes create a new version of the data item without blocking other transactions. ==How MVCC Works== MVCC operates based on the following principles: #Each transaction is assigned a unique timestamp at the start. #Data items maintain multiple versions, each with associated timestamps for creation and expiration. #Read and write operations follow these rules: #*A transaction reads the most recent version of a data item whose timestamp is less than or equal to the transaction's start timestamp. #*A transaction creates a new version of a data item during writes, ensuring isolation. ==Advantages== *'''Non-Blocking Reads:''' Readers do not block writers, and vice versa, improving concurrency. *'''Consistent Snapshots:''' Transactions operate on consistent snapshots of data without interfering with other transactions. *'''Deadlock-Free:''' MVCC avoids deadlocks by not requiring locks for reads. ==Limitations== *'''Storage Overhead:''' Maintaining multiple versions of data increases storage requirements. *'''Garbage Collection:''' Older versions of data must be periodically removed to free space. *'''Write Amplification:''' Frequent writes can generate a large number of versions, impacting performance. ==Example of MVCC== Consider a scenario with two transactions accessing a shared data item A: {| class="wikitable" !Step!!Transaction T1!!Transaction T2!!Explanation |- |1||BEGIN TRANSACTION (TS=1)||BEGIN TRANSACTION (TS=2)||T1 and T2 start with timestamps 1 and 2, respectively. |- |2||READ(A)||-||T1 reads the current version of A (value=100, TS=0). |- |3||-||WRITE(A, value=200)||T2 writes a new version of A with TS=2. |- |4||READ(A)||-||T1 still sees the version of A with TS=0 (value=100), ensuring a consistent snapshot. |- |5||COMMIT||COMMIT||Both transactions commit successfully. |}In this example, T1 reads the old version of A while T2 writes a new version, demonstrating how MVCC prevents conflicts. ==MVCC in Databases== MVCC is widely implemented in modern database systems: *'''PostgreSQL:''' Provides MVCC for high-performance and consistent transactions. *'''MySQL (InnoDB):''' Uses MVCC to support isolation levels like Repeatable Read and Read Committed. *'''Oracle Database:''' Implements MVCC to manage consistent reads and undo data. ==Variants of MVCC== *'''Snapshot Isolation:''' **Transactions work with a snapshot of the database at their start time. **Prevents dirty reads and non-repeatable reads but allows write skew. *'''Serializable Snapshot Isolation (SSI):''' **Extends snapshot isolation to detect and prevent write conflicts, ensuring serializability. ==See Also== *[[Concurrency Control]] *[[Timestamp-Based Protocol]] *[[Transaction Management]] *[[Snapshot Isolation]] *[[Serializable]] *[[Database Anomalies]] [[Category:Database]]
요약:
IT 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는
IT 위키:저작권
문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다.
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기
둘러보기
대문
최근 바뀜
광고
위키 도구
위키 도구
특수 문서 목록
문서 도구
문서 도구
사용자 문서 도구
더 보기
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
문서 기록