Skip to main content

CREATE CONCURRENT_LIMITING_RULE

Description

This statement is used to create a throttling rule, specifying 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 seekdb privileges, see seekdb privilege types.

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]

Parameter description

ParameterDescription
ccl_rule_nameRequired. The name of the throttling rule.
Note To avoid conflicts with SQL keywords, we recommend that you add a backtick (`) before and after the rule name.
database.tableRequired. The name of the database and data table. You can use an asterisk (*) to match any name.
Note To avoid conflicts with SQL keywords, we recommend that you add a backtick (`) before and after the rule name.
<usename>@<host>Required. The name of the account. The username can be specified as * to match all users. The host part can be specified as % to match any host.
ALL|UPDATE | SELECT | INSERT| DELETERequired. The type of the SQL statement. Currently, you can specify ALL, UPDATE, SELECT, INSERT, or DELETE.
Note Each throttling rule can only specify one type of SQL statement.
[ filter_options ]Optional. The throttling keywords.
Note
  • The keywords are connected with the wildcard%. For example, if you specify three keywords'asdasd', 'c2 = 123', 'xxyyzz', they are concatenated into '%asdasd%c2 = 123%xxyyzz%'. Subsequent SQL text matching is performed based on this string.
  • If a keyword contains'_', it will be escaped. For example, 'table_t1' will be recorded as'%table_t1%'.
  • There is no limit on the number of throttling keywords, but the length of the concatenated string must not exceed OB_MAX_VARCHAR_LENGTH=1048576.
with_optionsRequired. Specifies the concurrency limit and the statistical granularity of the throttling rule. Currently, only the MAX_CONCURRENCY parameter is supported. This parameter specifies the maximum concurrency of SQL statements that match the throttling rule.

Examples

Execute the following command to throttle based on keywords:

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;