Note
This parameter is available starting with V1.4.
Description
trace_log_slow_query_watermark specifies the execution time threshold for queries. If the execution time of a query exceeds this threshold, it is considered a slow query, and the trace log of the slow query is printed to the system log.
Privilege requirements
Query the parameter
The
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query this parameter.Modify the parameter
Only the
systenant can modify this parameter. User tenants cannot modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Time |
| Default value | 1s, with the default unit being milliseconds.
NoteStarting from V3.2.3, the default value is changed from 100ms to 1s. |
| Value range | [1ms, +∞) |
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
You can compare the SQL execution time with the value of trace_log_slow_query_watermark to determine whether it is a slow query. If the SQL execution time exceeds the value of trace_log_slow_query_watermark, it is considered a slow query. In this case, OceanBase Database prints the Slow Query message to the OBServer log. You can then search for the slow SQL statement in the OBServer log.
Examples
Set the query execution time threshold to 1s.
obclient> ALTER SYSTEM SET trace_log_slow_query_watermark = '1s';