Note
This variable is available starting with V1.4.
Description
tx_read_only specifies whether a transaction is read-only.
Privilege requirements
Query variables
Global level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle-compatible mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL-compatible mode) to obtain the values of global system variables.Session level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle-compatible mode) or theinformation_schema.SESSION_VARIABLESview (MySQL-compatible mode) to obtain the values of session system variables.
Modify variables
Global level
systenants can modify the values of global system variables.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.Oracle user tenants must have the
ALTER SYSTEMprivilege to modify the values of global system variables.
Session level
systenants and all user tenants can modify the values of session system variables.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0 |
| Value range |
|
| Scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Usage
After the system variable tx_read_only is set:
If the variable is set at the session level, it only affects the current user and does not affect other users.
If the variable is set at the global level, it affects all users who connect to the database in the future.
Examples
Set the transaction to read-only.
Session level
obclient> SET tx_read_only = 1;Global level
obclient> SET GLOBAL tx_read_only = 1;