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
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the value of a global system variable.Session level
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) or theinformation_schema.SESSION_VARIABLESview (MySQL mode) to view the value of a session system variable.
Modify variables
Global level
systenant can modify the value of a global system variable.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.Oracle user tenants must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Session level
systenant and all user tenants can modify the value of a session system variable.
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 you set the tx_read_only variable:
If the variable takes effect at the session level, it affects only the current user.
If the variable takes effect at the global level, it affects all users who connect to the database after the variable is set.
Examples
Set the transaction to a read-only transaction.
Session level
obclient> SET tx_read_only = 1;Global level
obclient> SET GLOBAL tx_read_only = 1;
