MariaDB Xpand Transaction Isolation Levels
MariaDB Xpand uses transaction isolation levels and Multi-Version Concurrency Control (MVCC) to determine which data is visible for a given transaction.
This documentation applies to both Xpand topologies. Most examples are designed for the Xpand Performance Topology. However, the examples explicitly mention any differences that are relevant for the Xpand Storage Engine Topology.
Supported Transaction Isolation Levels
MariaDB Xpand supports the following transaction isolation levels to user transactions:
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:
Repeatable Read (default)
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_isolation system variable:
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.
SET SESSION tx_isolation='REPEATABLE-READ';
It can also be set by executing SET SESSION TRANSACTION:
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;