Description
This statement is used to create a rate-limiting rule and specify the throttling scope to limit the concurrency of specific SQL statements.
Privilege requirements
To execute the CREATE CONCURRENT_LIMITING_RULE statement, the current user must have the CREATE privilege. For more information about OceanBase AI Database privileges, see Permission classification.
Syntax
CREATE CONCURRENT_LIMITING_RULE [ IF NOT EXISTS ] `ccl_rule_name`
ON `database`.`table`
TO '<usename>'@'ip'
FOR { ALL | UPDATE | SELECT | INSERT | DELETE }
filter_options:
[ FILTER BY KEYWORD('KEYWORD1', 'KEYWORD2',…) ]
with_options:
WITH MAX_CONCURRENCY = value1 [per sql]
Parameters
Parameter |
Description |
|---|---|
ccl_rule_name |
Required. The name of the throttling rule.
NoteTo avoid conflicts with SQL keywords, we recommend that you add a backtick ( |
database.table |
Required. The name of the database or table. You can use an asterisk (*) to match any characters.
NoteTo avoid conflicts with SQL keywords, we recommend that you add a backtick ( |
<usename>@<host> |
Optional. The username, which can contain an asterisk (*) to represent all users. In the host field, a percent sign (%) can be used to indicate any match. |
ALL\ | UPDATE \ \| SELECT \ \| INSERT\ \| DELETE |
Required. Indicates the type of SQL statement. Currently supported: ALL, UPDATE, SELECT, INSERT and DELETE. Type.
NoteEach rate-limiting rule supports only one type of SQL statement. |
[ filter_options ] |
Optional. Specifies the throttling keywords.
Note
|
with_options |
Required. Specifies the concurrency level for rate limiting and whether the throttling statistics are counted at the rule level or the format SQL ID statement level. Currently, only MAX_CONCURRENCY parameter, which indicates the maximum concurrency of SQL statements that match this throttling rule. |
Examples
Run the following command to enable throttling by keyword:
obclient> CREATE CONCURRENT_LIMITING_RULE IF NOT EXISTS `sql1_keywords_ccl_rule`
ON *.* TO '%'@'%' FOR SELECT
FILTER BY KEYWORD('table1', 'table2', 'c1') WITH MAX_CONCURRENCY 100;