Creating a Concurrency Control Rule
Scenarios
You can create rules to control concurrent execution of SQL statements by specifying original SQL statements or query ID. When the number of matched SQL statements exceeds the maximum number of concurrent SQL statements allowed, the DB instance rejects the SQL statements to ensure stability. SQL statement concurrency control of RDS for PostgreSQL is implemented using Huawei-developed extension rds_pg_sql_ccl.
It can be used in the following scenarios:
- When workloads increase sharply, the instance stability is ensured by limiting the execution of a certain type of SQL statements.
- When there are not enough resources, the success of core tasks is ensured by limiting the execution of other SQL statements to reduce resource consumption.
Supported Versions
SQL statement concurrency control is available in the following versions:
- RDS for PostgreSQL 15: 15.4 and later
- RDS for PostgreSQL 14: 14.8 and later
- RDS for PostgreSQL 13: 13.11 and later
- RDS for PostgreSQL 12: 12.15 and later
- RDS for PostgreSQL 11: 11.20 and later
Constraints
- SQL statements executed by built-in users (rdsAdmin, rdsMetric, rdsRepl, and rdsBackup) are not affected by concurrency control rules.
- To use SQL statement concurrency control, the rds_pg_sql_ccl extension must be installed. For details, see Installing and Uninstalling an Extension on the RDS Console.
Procedure
- Log in to the management console.
- Click in the upper left corner and select a region.
- Click in the upper left corner of the page and choose Databases > Relational Database Service.
- On the Instances page, click the target DB instance name.
- In the navigation pane, choose DBA Assistant > Historical Diagnosis.
- Choose SQL Explorer > Concurrency Control.
- Toggle on the concurrency control switch .
Concurrency control rules take effect only after concurrency control is enabled.
- Click Add Rule. Configure the parameters listed in Table 1.
Configure SQL statement concurrency control rules based on workloads and resource usage.
Figure 1 Creating a Concurrency Control Rule
Table 1 Parameter description Parameter
Description
Mode
Max. Concurrency
The maximum allowed number of concurrent SQL statements that match the rule. SQL statements exceeding this upper limit will not be executed.
The value ranges from 0 to 50000. 0 indicates that the concurrency of SQL statements is not limited.
Max. Wait Time
Wait time before the SQL statements can be executed. The value ranges from 0 to 1000000000.
- Confirm the settings and click OK.
- A rule is not applied immediately after being created. To apply the rule, click Enable.
Follow-up Operations
If a concurrency control rule is not required, you can disable or delete it in the Operation column.
- To disable a rule, click Disable.
- To delete a rule, click Delete. After a concurrency control rule that is enabled is deleted, the rule is not applied anymore.
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