Purpose
This statement is used to set SQL feature throttling. It allows SQL requests that meet the throttling criteria to fail early, preventing them from affecting normal requests.
Syntax
alter_system_throttle_stmt:
ALTER SYSTEM throttle_action;
throttle_action:
ENABLE SQL THROTTLE [priority_option] [using_metric_option_list]
| DISABLE SQL
priority_option:
FOR PRIORITY <= INT_VALUE
using_metric_option_list:
USING metric_option_list
metric_option_list:
metric_option [metric_option ...]
metric_option:
RT = {INT_VALUE | DECIMAL_VALUE}
| CPU = {INT_VALUE | DECIMAL_VALUE}
| IO = INT_VALUE
| NETWORK = {INT_VALUE | DECIMAL_VALUE}
| QUEUE_TIME = {INT_VALUE | DECIMAL_VALUE}
| LOGICAL_READS = {INT_VALUE | DECIMAL_VALUE}
Parameters
| Parameter | Description |
|---|---|
| ENABLE SQL | Enables throttling, followed by the throttling criteria and its value. |
| FOR PRIORITY | Specifies the priority affected by throttling, so that throttling only affects a subset of sessions. You can set the priority of the current session using the session-level variable sql_throttle_priority, which defaults to -1. For more information about this variable, see the System Variables section in the Reference Guide. For example, if sessions a, b, and c have priorities 1, 2, and 3 respectively, setting ALTER SYSTEM ENABLE SQL THROTTLE FOR PRIORITY <= 2 USING QUEUE_TIME=0.1; means that sessions a and b are affected by throttling, while session c is not. |
| RT | Throttles based on SQL response time (Response Time). Unit: seconds. |
| CPU | Throttles based on CPU usage.
NoteThis parameter is not supported in the current version. |
| IO | Throttles based on the number of I/O operations.
NoteThis parameter is not supported in the current version. |
| NETWORK | Throttles based on the amount of network traffic transmitted.
NoteThis parameter is not supported in the current version. |
| QUEUE_TIME | Throttles based on queue wait time. Unit: seconds. |
| LOGICAL_READS | Throttles based on the number of logical reads.
NoteThis parameter is not supported in the current version. |
| DISABLE SQL | Disables throttling. |
Examples
Throttle requests with a queue wait time exceeding 0.1s for sessions with PRIORITY less than or equal to 100.
obclient> ALTER SYSTEM ENABLE SQL THROTTLE FOR PRIORITY <= 100 USING QUEUE_TIME=0.1;
