THROTTLE
Description
This statement is used to throttle SQL requests based on specific features. It allows 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 feature and its value. |
| FOR PRIORITY | Specifies the priority level affected by throttling, ensuring that throttling only affects certain sessions. You can set the priority for the current session using the session-level variable sql_throttle_priority, which defaults to -1. 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. This parameter is not supported in the current version. |
| IO | Throttles based on I/O operations. This parameter is not supported in the current version. |
| NETWORK | Throttles based on the amount of network traffic transmitted. This 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. This 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 a priority less than or equal to 100.
ALTER SYSTEM ENABLE SQL THROTTLE FOR PRIORITY <= 100 USING QUEUE_TIME=0.1;