Note
This statement was introduced in OceanBase Database V4.3.5 BP3 for V4.3.X versions.
It was introduced in OceanBase Database V4.4.1 for V4.4.X versions.
Purpose
This statement is used to create a throttling 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 Database privileges, see Privilege classification in MySQL mode
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 name conflicts with SQL keywords, we recommend that you enclose the rule name in backticks (`) on both sides. |
database.table |
Required. The name of the database and data table. You can use the asterisk (*) to match any name.
NoteTo avoid name conflicts with SQL keywords, we recommend that you enclose the rule name in backticks (`) on both sides. |
<username>@<host> |
Required. The name of the account. The username supports the * wildcard to match all users. The host part supports the % wildcard to match any host. |
ALL|UPDATE \| SELECT \| INSERT\| DELETE |
Required. The type of SQL statements. The following types are supported: ALL, UPDATE, SELECT, INSERT, and DELETE.
NoteEach throttling rule can specify only one type of SQL statements. |
[ filter_options ] |
Optional. The throttling keywords.
Note
|
with_options |
Required. The concurrency control options. The concurrency control options specify whether the throttling statistics are at the rule level or at the statement level. Currently, only the MAX_CONCURRENCY parameter is supported. It specifies the maximum concurrency of SQL statements that match the throttling rule. |
Examples
Execute the following command to throttle based on keywords:
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;
