Note
This variable was introduced in OceanBase Database V4.1.0.
Description
ob_max_read_stale_time specifies the maximum latency threshold, in μs, for weak-consistency read queries.
Applicability
This variable is applicable to only OceanBase Database in MySQL mode.
Limitations
Query the variable
Global-level operation
In the
systenant or a user tenant, you can execute theSHOW VARIABLESstatement to query the variable at the global level or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (in Oracle mode) orinformation_schema.GLOBAL_VARIABLESview (in MySQL mode) for the variable at the global level.Session-level operation
In the
systenant or a user tenant, you can execute theSHOW VARIABLESstatement to query the variable at the session level or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (in Oracle mode) orinformation_schema.SESSION_VARIABLESview (in MySQL mode) for the variable at the session level.
Modify the variable
Global-level operation
In the
systenant, you can directly change the value of the variable at the global level.In a MySQL user tenant, you must have the
SUPERorALTER SYSTEMprivilege to change the value of the variable at the global level.
Session-level operation
In the
systenant or a user tenant, you can directly change the value of the variable at the session level for the current tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | Integer |
| Default value | -1, which indicates ineffective.
NoteThe default value is changed from |
| Value range | [-1, 9223372036854775807]
NoteIn OceanBase Database V4.1.0 BP2 and later, the value range is changed from [0, 9223372036854775807] to [-1, 9223372036854775807]. |
| Effective scope |
|
| Modifiable | Yes. You can use the SET statement to modify the variable. |
Considerations
When the latency threshold for weak-consistency reads is controlled at the session level, the data returned for weak-consistency read requests in the current session must fall within the specified latency threshold. However, you can set a different latency threshold for other sessions.
Examples
Set the maximum latency threshold for weak-consistency read queries to 5,000,000 μs.
Session-level operation
obclient> SET ob_max_read_stale_time =5000000;Global-level operation
obclient> SET GLOBAL ob_max_read_stale_time =5000000;