Description
This statement is used to set throttling for SQL statements. It causes SQL requests that match the specified throttling criteria to fail prematurely, 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
Parameters |
Description |
|---|---|
| ENABLE SQL | Enable throttling, followed by the throttling feature and its value. |
| FOR PRIORITY | Set the priority affected by rate limiting to ensure that the throttling effect only takes effect on some sessions. You can use the session-level variable sql_throttle_priority Sets the priority of the current session. The default value is -1. For more information about this variable, see the System variables section in the Reference guide. For example, if the priorities of Sessions a, b, and c are 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 rate limiting, while c is not. |
| RT | Throttling based on SQL response time, in seconds. |
| CPU | Throttling by CPU usage.
NoteThis parameter is not supported in the current version. |
| IO | Throttling by I/O count.
NoteThis parameter is not supported in the current version. |
| NETWORK | Throttles based on the size of transmitted network traffic.
NoteThis parameter is not supported in the current version. |
| QUEUE_TIME | Throttling based on queue waiting time. Unit: seconds. |
| LOGICAL_READS | Throttles logical reads.
NoteThis parameter is not supported in the current version. |
| DISABLE SQL | Disable throttling. |
Examples
Throttle requests on sessions with PRIORITY less than or equal to 100 that exceed a queue wait time of 0.1s.
obclient> ALTER SYSTEM ENABLE SQL THROTTLE FOR PRIORITY <= 100 USING QUEUE_TIME=0.1;