[Altibase] 6 what is the mvcc

273 views

Published on

what is the mvcc

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
273
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

[Altibase] 6 what is the mvcc

  1. 1. Concurrency Control  Method that prevent the inconsistency, loss and the changes while processing multiple transactions.  Lock is provided for concurrency control to let multiple transactions change different data from a same table while they are not affecting each other. Table
  2. 2. Concurrency  Multiple users or sessions accessing same data at same time Consistency  Restricting multiple users or sessions accessing same data at same time Concurrency Consistency
  3. 3. Transaction Lock  Prevents modifying same data in a multi-user environment  Automatically grants the lock for DML and DDL  To provide maximum consistency  Two different locks: Row level lock & Table level lock Trasaction1 UPDATE emp SET salary = 1,000,000 WHERE id = ‘alti100’ Trasaction2 UPDATE emp SET salary = 2,000,000 WHERE id = ‘alti100’ Lock granted Waiting……
  4. 4. SVCC vs. MVCC  Methods for controlling simultaneous read / modify operations on the same records SVCC (Single-Version Concurrency Control)  With this method, only one version (or “image”) of a record exists.  Even search operations can affect other transactions. MVCC (Multi-Version Concurrency Control)  With this technique, when a record is changed, the original version of the record is maintained and unchanged. A new changed version of the record is created, so that even if one transaction is performing an operation on a record, it will have no effect on another transaction that reads the same record.
  5. 5. SVCC  Because a record is locked when it is modified, conflicts can occur between read and modifying operations, thus there is a high possibility of reduced performance in environments characterized by frequent transactions. SVCC Client UPDATE t1 SET c1=20 WHERE c1=10 10 120 Client SELECT c1 FROM t1 Commit Commit Success Exclusive Mode Lock Waiting…. Output Displayed
  6. 6. MVCC  When a record is modified, it is locked and a new version of the record is created, so conflicts do not occur between read and modifying operations.  Good performance is guaranteed, even in environments characterized by frequent transactions. Client UPDATE t1 SET c1=20 WHERE c1=10 10 1 Client SELECT c1 FROM t1 Commit Commit Success Exclusive Mode Lock Output(10) 10 120 SELECT c1 FROM t1 Output(20)
  7. 7. Out-place MVCC is used for Memory tables  New versions of records are saved together with old versions every time an UPDATE operation occurs.  New version of a record is saved in the data page with a different Row ID.  When a transaction is committed, only the most recent version of the record is maintained, the rest are deleted by the garbage collector (Memory Ager). Out-place (RID Change) Data Page Client UPDATE t1 SET c1=20 WHERE c1=10 101 2 1020 Client SELECT c1 FROM t1 Commit Commit Success Output displayed(10)Output displayed(20) Memory Ager
  8. 8. In-place MVCC is used for disk tables  In in-place MVCC, when an UPDATE operation occurs, the contents of modified columns that belong to the original record are written as undo log records to the Undo tablespace, and the modified values are written to the location of the original record. In-place (RID Maintained) Data Page Undo Area 201 10 Client UPDATE t1 SET c1=20 WHERE c1=10 Client SELECT c1 FROM t1 Commit Commit Success Output displayed(10)Output displayed(20) 1 10

×