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 for MySQL

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesEnableSqlConcurrencyControl

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

ConsoleContextStringNoNone

A hidden parameter.

InstanceIdStringYesrm-2ze1jdv45i7l6****

The ID of the instance.

Note The instance must be an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance.
SqlTypeStringYesSELECT

The type of the SQL statements. Valid values:

  • SELECT
  • UPDATE
  • DELETE
MaxConcurrencyLongYes3

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.
SqlKeywordsStringYescall~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.
ConcurrencyControlTimeLongYes300

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

Note The throttling rule takes effect only within this duration.

Response parameters

ParameterTypeExampleDescription
CodeString200

The returned status code.

MessageStringSuccessful

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.
DataStringnull

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

RequestIdStringB6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

SuccessStringtrue

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

HttpCodeError codeError messageDescription
400InvalidParamsThe 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.