Transaction Isolation Levels for MariaDB Xpand
This page is part of MariaDB's Documentation.
The parent of this page is: Transaction Isolation
Topics on this page:
Overview
MariaDB Xpand uses transaction isolation levels and Multi-Version Concurrency Control (MVCC) to determine which data is visible for a given transaction.
Supported Transaction Isolation Levels
MariaDB Xpand supports the following transaction isolation levels to user transactions:
Repeatable Read
Transaction Visibility
Each transaction isolation level has different transaction visibility rules. The rules depend on the Transaction, Invocation, and Commit IDs generated by Xpand.
MariaDB Xpand does not support the Read Uncommitted isolation level, so an uncommitted transaction is never visible to other transactions. Once the transaction commits, it generates a commit identifier (cid
). The commit identifier (cid
) is used to determine whether the transaction's modifications should be visible to another transaction.
The following table describes the transaction visibility rules for each transaction isolation level:
Isolation Level | Snapshot Anchor | Comment |
---|---|---|
Repeatable Read (default) | transaction |
|
Read Committed | statement |
|
Serializable | transaction |
|
The following diagram shows how transaction visibility works at different isolation levels.
Checking the Transaction Isolation Level
MariaDB Xpand only supports the Repeatable Read transaction isolation level for end user transactions. To confirm that your session is using a supported transaction isolation level, check the session value of the tx_
SHOW SESSION VARIABLES LIKE 'tx_isolation';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| tx_isolation | REPEATABLE-READ |
+---------------+-----------------+
Setting the Transaction Isolation Level
There are two methods to set your session's transaction isolation level.
The tx_
SET SESSION tx_isolation='REPEATABLE-READ';
It can also be set by executing SET SESSION TRANSACTION:
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;