SQL Statement Concurrency Control
SQL statement concurrency control restricts the execution of SQL statements based on specified rules when there are SQL statements that cannot be optimized timely or a resource (for example, vCPU) bottleneck occurs.
Precautions
- RDS for MariaDB using only the engine version 10.5.16.230600 or higher support Concurrency Control.
- The new Concurrency Control rule takes effect only for the current DB instance.
- If a SQL statement matches multiple concurrency control rules, only the latest rule takes effect.
- SQL statements that have been executed before a concurrency control rule is added are not counted.
- Keywords in a concurrency control rule are sorted in a specific order, and the system will match them from first to last. For example, if one rule contains the keyword a~and~b, the system only matches xxx a>1 and b>2.
- If the replication delay is too long, adding or deleting a concurrency control rule for a read replica does not take effect immediately.
- Empty characters before and after each keyword will be ignored, for example, spaces, \n, \r, and \t.
- SQL statement concurrency control does not limit concurrency for:
- System tables
- SQL statements used to query data, for example, SELECT sleep(xxx)
- Account root
- SQL statements in stored procedures, triggers, and functions
Procedure
- Log in to the DAS console.
- Click in the upper left corner and select a region and project.
- Click in the upper left corner, and under Databases, click Data Admin Service.
- In the navigation pane, choose Intelligent O&M > Instance List.
Alternatively, on the Overview page, click Go to Intelligent O&M.
- In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
Figure 1 Searching for instances
- Locate the box containing your target instance and click Details.
- Choose SQL > SQL Statement Concurrency Control.
- On the displayed page, toggle on Concurrency Control.
Figure 2 Enabling SQL statement concurrency control
- Click Add Rule. In the displayed dialog box, specify SQL Type, Keyword, and Max. Concurrency.
Figure 3 Add Rule
Table 1 Parameters Parameter
Remarks
SQL Type
The options are SELECT, UPDATE, and DELETE.
Keyword
A maximum of 128 case-insensitive keywords are supported. You can specify keywords in either of the following ways:
- Enter keywords. Take select~a as an example. select and a are two keywords contained in a concurrency control rule. The keywords are separated by a tilde (~). In this example, the rule restricts the execution of only the SQL statements containing keywords select and a.
- Generate keywords from a SQL statement. You can enter an SQL statement to the text box and click Generate Keyword. Keywords generated from an original SQL statement are only for reference.
Max. Concurrency
SQL statements that meet the specified SQL type and keyword and exceed the value of Max. Concurrency will not be executed.
Kill existing sessions that match this rule
If this option is selected, the connection sessions of user root will not be killed.
- Confirm the settings and click OK.
If a SQL statement concurrency control rule is no longer needed, click Delete in the Operation column.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot