tencent cloud

Creating a SQL Traffic Throttling Task
Last updated: 2025-07-09 14:52:25
Creating a SQL Traffic Throttling Task
Last updated: 2025-07-09 14:52:25
DBbrain supports the SQL traffic throttling feature. You can create SQL traffic throttling tasks and set the SQL type, maximum concurrency, traffic throttling duration, and SQL keywords to limit the number of requests to the database and the amount of SQL concurrency, so as to achieve service availability. There is no conflict between different tasks.
The SQL traffic throttling feature also supports viewing, closing, and deleting SQL traffic throttling tasks.

Supported Versions

MySQL: It only supports MySQL 5.7-20200331 and later versions, MySQL 5.6-20200915 and later versions, and MySQL 8.0-20211202 and later versions.
TDSQL-C for MySQL: It only supports MySQL 5.7-2.1.9 and later versions,and MySQL 8.0-3.1.5 and later versions.

Directions

Creating a SQL Traffic Throttling Task

1. Log in to the DBbrain console.
2. In the left sidebar, choose Diagnosis and Optimization.
3. At the top of the page, select the database type and instance ID, and select the Real-Time Session tab.
4. On the Real-Time Session page, select the SQL Throttling tab.



5. Click Create Task, configure task parameters as prompted on the page, and click OK after configuration.



The parameter description is shown in the following table.
Parameter
Description
SQL type
It includes SELECT, UPDATE, DELETE, INSERT, and REPLACE.
Max Concurrency
It indicates the maximum concurrency of SQL. If the SQL containing keywords reaches the maximum concurrency, the SQL traffic throttling policy will be triggered. If this value is set to 0, it restricts all matched SQL executions.
Execution Mode
It includes Scheduled stop and Manual stop.
Scheduled stop: After you select scheduled closure, you need to set the task traffic throttling time. The task will start executing upon submission and will automatically be closed when the execution time ends. The task can also be manually closed in the operation column of the task list during execution.
Manual stop: After you select manual closure, the task will continue to execute upon submission until it is manually closed in the operation column of the task list.
SQL Keyword
It indicates the SQL keywords that require traffic throttling.
You can enter SQL statements. The system will automatically split the keywords using space, comma, and line break as delimiters. The logical relationship between multiple keywords is AND, regardless of order.
Note:
Since SQL keywords are matched as strings, and the order or whether they refer to database names or table names is not considered, the more SQL keywords you enter, the more precise the traffic throttling.
If sharded databases and sharded tables require traffic throttling, you should enter the database name prefix or table name prefix in the SQL keywords. For example, if multiple tables with the same prefix (such as user_01, user_02, and user_03) require traffic throttling, the SQL keywords setting example is as follows:



Since SQL keywords are matched as strings, similar SQL statements may also trigger the above-specified keyword traffic throttling tasks.
select *,user_ from server;
When the instance reaches the maximum concurrency set by the traffic throttling task, SQL statements containing the SQL keywords will be rejected.
The error code for rejected statements in SQL traffic throttling is displayed as: ERROR 4513: SQL rejected by CDB_SQL_FILTER.

Viewing, Closing, and Deleting SQL Traffic Throttling Tasks

1. Go to the SQL Throttling task list.
2. View, close, and delete SQL traffic throttling tasks.



The list parameter description is shown in the following table:
Parameter
Description
Type
It includes SELECT, UPDATE, DELETE, INSERT, and REPLACE.
Status
It includes Running, Completed, and Terminated.
Running: The task is in progress.
Completed: The task with the execution method set to Automatic Closure will be automatically closed after the specified task traffic throttling time ends.
Terminated: There are two situations.
The task with the execution method set to Automatic Closure will be manually closed before the specified task execution time ends.
The task with the execution method set to Manual Closure will be manually closed.
Keyword
Keywords set when a SQL traffic throttling task is created.
Start Time
Start execution time of the traffic throttling task.
Remaining Time
Remaining traffic throttling time for the traffic throttling task.
When a task is created, the task execution time is Automatic Closure:
When the status is Running, Remaining time = Traffic throttling time (set when a task is created) - Start time (displayed in the task list).
When the status is Completed or Terminated, the remaining time is 0.
When a task is created, the task execution time is Manual Closure: The remaining time displays --.
Max Concurrency
Maximum concurrency set when a SQL traffic throttling task is created.
Source
Initiated by User: It indicates the SQL traffic throttling task created on the Real-Time Sessions page.
Operation
View task details: Click Details in the Operation column to view the task's start time, execution time, end time, and rejected SQL count.
Close task: When you need to terminate a task with the status Running, click Close in the Operation column.
Delete task: When you need to delete a task with the status Terminated or Completed, you can delete tasks individually or in batches.
Single deletion: Click Delete in the Operation column of the corresponding task.
Batch deletion: Select one or more tasks to be deleted in the hot spot update protection task list, and click Delete at the top of the task list.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback