Overview
trace_log_slow_query_watermark specifies the execution time threshold for a query to be considered a slow query. If a query's execution time exceeds this threshold, its trace logs are printed to the system log.
Privilege requirements
Query parameters
Both the
systenant and all user tenants can query this parameter using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify parameters
Only the
systenant can modify this parameter. User tenants cannot modify it.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Time |
| Default Value | 1s. The default unit is milliseconds. |
| Value range | 1ms, +∞) |
| Modifiable | Yes, you can use the following methods:ALTER SYSTEM SETStatement modification. |
| Whether to restart the OBServer node for the change to take effect | No, the setting takes effect immediately. |
Usage instructions
You can determine whether an SQL statement is a slow query by comparing its execution time to the trace_log_slow_query_watermark value. If the SQL execution time exceeds this value, it is considered a slow query. In such cases, OceanBase AI Database prints a Slow Query message in the OBServer log, allowing you to locate the slow SQL statements through the OBServer logs.
Configuration example
Set the query execution time threshold to 1s.
obclient> ALTER SYSTEM SET trace_log_slow_query_watermark = '1s';
References
[Query SQL request logs