Created
December 22, 2023 08:19
-
-
Save FranckPachot/a33432bae47ce8077da51535a87d7a92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tbody><tr> | |
<td> | |
<strong>MVCC Isolation level</strong> | |
</td> | |
<td> | |
<strong>Serializable Snapshot Isolation</strong> | |
</td> | |
<td> | |
<strong>Snapshot Isolation</strong> | |
</td> | |
<td> | |
<strong>Read Committed</strong> | |
</td> | |
<td> | |
<strong>NoSQL-like single-object consistency</strong> | |
</td> | |
</tr> | |
<tr> | |
<td colspan="5"> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Set by (in YugabyteDB or PostgreSQL)</strong> | |
</td> | |
<td> | |
<strong>Serializable</strong> | |
</td> | |
<td> | |
<strong>Repeatable Read & Read Only</strong> | |
</td> | |
<td> | |
<strong>Read Commited & Read Uncommited</strong> | |
</td> | |
<td> | |
<strong>Non-Transactional write</strong> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Use case</strong> | |
</td> | |
<td>OLTP complex transactions with no explicit locking, and guaranteed without anomalies | |
</td> | |
<td>OLTP short transactions with retry logic, or long read-only transactions | |
</td> | |
<td>OLTP preventing anomalies with explicit locking rather than retry logic | |
</td> | |
<td>Fast data-ingest that doesn't require atomic visibility | |
</td> | |
</tr> | |
<tr> | |
<td colspan="5"> | |
<strong>Characteristics</strong> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Read Time</strong> | |
</td> | |
<td>start of transaction | |
</td> | |
<td>start of transaction | |
</td> | |
<td>start of statement | |
</td> | |
<td>Depends on transaction isolation level | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Write Time</strong> | |
</td> | |
<td>commit (if no anomalies) | |
</td> | |
<td>commit (if no anomalies) | |
</td> | |
<td>commit (if no deadlocks) | |
</td> | |
<td>each row has its write time | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Development Constraints</strong> | |
</td> | |
<td>retry logic | |
</td> | |
<td>retry logic for basic anomalies and explicit locking if possibility of write skew | |
</td> | |
<td>explicit locking to avoid read and write skew and lost update, and statement ordering for deadlocks | |
</td> | |
<td>enable non-transactional write | |
<p> | |
(implicit only for sequences) | |
</p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Implementation in MVCC</strong> | |
</td> | |
<td>Snapshot Isolation + read intents | |
</td> | |
<td>Snapshot Isolation | |
</td> | |
<td>Snapshot per statement, statement restart | |
</td> | |
<td>row timestamp is the write time rather than the commit time | |
</td> | |
</tr> | |
<tr> | |
<td colspan="5"> | |
<strong> | |
Implementation specificities</strong> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>Oracle</strong> | |
</td> | |
<td> | |
<ul> | |
<li>still shows some anomalies | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>set with "serializable" | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>The default and most used | |
</li> | |
<li>waits on enqueue | |
</li> | |
<li>update restarts to get consistent result in RC | |
</li> | |
</ul> | |
</td> | |
<td> | |
(in-Memory fast ingest) | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>SQL Server</strong> | |
</td> | |
<td> | |
<ul> | |
<li>predicate lock with range locks | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>Only with read locks | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>The default with read locks | |
</li> | |
<li>No read locks when using MVCC snapshots | |
</li> | |
<li>no restart (lock and wait) | |
</li> | |
</ul> | |
</td> | |
<td> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>MySQL</strong> | |
</td> | |
<td> | |
<ul> | |
<li>predicate lock with range locks | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>default but not fully complies with RR | |
</li> | |
</ul> | |
</td> | |
<td> | |
</td> | |
<td> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>PostgreSQL</strong> | |
</td> | |
<td> | |
<ul> | |
<li>keeps track of predicates | |
</li> | |
<li>anomaly detection at commit | |
</li> | |
<li>all conflicting transactions must be serializable | |
</li> | |
</ul> | |
</td> | |
<td> | |
</td> | |
<td> | |
<ul> | |
<li>waits on enqueue | |
</li> | |
<li>no restart (can be inconsistent) | |
</li> | |
<li>default | |
</li> | |
</ul> | |
</td> | |
<td> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<strong>YugabyteDB</strong> | |
</td> | |
<td> | |
<ul> | |
<li>keeps track of read intents (distributed) | |
</li> | |
<li>anomaly detection on writes | |
</li> | |
<li>all conflicting transactions must be serializable | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>the default only when RC is disabled | |
</li> | |
</ul> | |
</td> | |
<td> | |
<ul> | |
<li>the default (when RC is enabled) | |
</li> | |
<li>wait queue, update restarts, deadlock detection | |
</li> | |
</ul> | |
</td> | |
<td> | |
</td> | |
</tr> | |
</tbody></table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment