Note
This variable is available starting with in V1.4.
Description
The tx_read_only variable specifies whether a transaction is read-only.
Privilege requirements
Query variables
Global level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (in Oracle-compatible mode) or theinformation_schema.GLOBAL_VARIABLESview (in MySQL-compatible mode) to query the value of a global system variable.Session level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (in Oracle-compatible mode) or theinformation_schema.SESSION_VARIABLESview (in MySQL-compatible mode) to query the value of a session variable.
Modify variables
Global level
The
systenant can directly modify the value of a global system variable.MySQL-compatible tenants must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.Oracle-compatible tenants must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Session variables
The
systenant and all user tenants can directly modify the value of a session system variable in their respective tenant.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Int |
| Default value | 0 |
| Valid values |
|
| Effective scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Considerations
After you set the tx_read_only variable, the setting takes effect as follows:
If the setting takes effect at the session level, it affects only the current user and does not affect other users.
If the setting takes effect at the global level, it affects all users who establish new connections.
Examples
Set a transaction to be read-only.
Session level
obclient> SET tx_read_only = 1;Global level
obclient> SET GLOBAL tx_read_only = 1;