Enables SQL throttling to control the numbers of database access requests and concurrent SQL statements.

This operation is applicable to the following database services:

  • RDS MySQL
  • PolarDB MySQL

Request parameters

Parameter Type Required Example Description
Action String Yes EnableSqlConcurrencyControl

The operation that you want to perform. Set the value to EnableSqlConcurrencyControl.

ConsoleContext String No None

A hidden parameter.

InstanceId String Yes rm-2ze1jdv45i7l6****

The ID of the instance.

Note The instance must be an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance.
SqlType String Yes SELECT

The type of the SQL statements. Valid values:

  • SELECT
  • UPDATE
  • DELETE
MaxConcurrency Long Yes 3

The maximum number of concurrent SQL statements. The value must be a positive integer.

Note When the number of concurrent SQL statements that contain the specified keywords reaches the upper limit specified by this parameter, the throttling rule is triggered.
SqlKeywords String Yes call~open~api~test~4~from~POP

The one or more SQL keywords that are contained in the SQL statements on which you want to trigger throttling.

Note If you specify multiple SQL keywords, separate them with tildes (~). When the number of concurrent SQL statements that contain all the specified SQL keywords reaches the specified upper limit, the throttling rule is triggered.
ConcurrencyControlTime Long Yes 300

The duration within which the SQL throttling rule takes effect. Unit: seconds.

Note The throttling rule takes effect only within this duration.

Response parameters

Parameter Type Example Description
Code String 200

The returned status code.

Message String Successful

The message returned for the request.

Note If the request is successful, Successful is returned. If the request fails, an error message such as an error code is returned.
Data String null

The detailed information, including the error codes and the number of error messages.

RequestId String B6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

Success String true

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request failed.

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=EnableSqlConcurrencyControl
&ConsoleContext=None
&InstanceId=rm-2ze1jdv45i7l6****
&SqlType=SELECT
&MaxConcurrency=3
&SqlKeywords=SELECT~min~id~max~id~FROM~task_event~WHERE~gmt_modified~AND~begin_time
&ConcurrencyControlTime=300
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<EnableSqlConcurrencyControlResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <Data>"Data": { "total": 1, "list":[...] }, "Code": 200, "Success": true }</Data>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Success>true</Success>
</EnableSqlConcurrencyControlResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Code" : "200",
  "Message" : "Successful",
  "Data" : "\"Data\": { \"total\": 1, \"list\":[...] }, \"Code\": 200, \"Success\": true }",
  "RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success" : "true"
}

Error codes

HttpCode Error code Error message Description
400 InvalidParams The request parameters are invalid. The error message returned because the specified request parameters are invalid.

For a list of error codes, visit the API Error Center.