Obtaining Recommended SQL Throttling Rules
Function
This API is used to obtain recommended SQL throttling rules based on real-time sessions. Before calling this API:
- Learn how to authenticate this API.
- Obtain the required region and endpoint.
Debugging
You can debug this API in API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the permission listed below is required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
gaussdb:instance:listSqlLimitRecommendRules
read
instance
-
-
-
URI
POST /v3/{project_id}/instances/{instance_id}/limit-task/recommend-rule
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain the value, see Obtaining a Project ID. Constraints N/A Range The value can contain 32 characters. Only letters and digits are allowed. Default Value N/A |
| instance_id | Yes | String | Definition Instance ID, which uniquely identifies an instance. For details about how to obtain the instance ID, see Querying DB Instances. Constraints N/A Range The value can contain 36 characters. Only letters and digits are allowed. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. You can obtain the token by calling the IAM API used to obtain a user token. After a response is returned, the value of X-Subject-Token in the response header is the token. Constraints N/A Range N/A Default Value N/A |
| X-Language | No | String | Definition Language of the information returned by the API. Constraints N/A Range
Default Value en-us |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| recommend_type | No | String | Definition Type of recommended SQL throttling rules. Constraints N/A Range
Default Value all |
| recommend_count | No | Integer | Definition Number of recommended SQL throttling rules. Constraints N/A Range 1–2,147,483,647 Default Value 5 |
| use_ops_tunnel | No | Boolean | Definition Emergency access channel. In high-load or full-thread-pool scenarios, the O&M commands delivered for SQL throttling tasks by the management plane through the common channel may fail or time out. In this case, the emergency access channel can be used to ensure that the O&M commands can be executed properly in special scenarios. Constraints N/A Range
Default Value false |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| total_count | Integer | Definition Total number of throttling rules. Range N/A |
| recommend_rules | Array of objects | Definition List of recommended rules. For details, see Table 5. |
| Parameter | Type | Description |
|---|---|---|
| recommend_type | String | Definition Type of recommended SQL throttling rules. Range
|
| sql_id | String | Definition ID of a SQL throttling rule. Range N/A |
| sql_model | String | Definition SQL template of a SQL throttling rule. Range N/A |
| sql_keyword | String | Definition SQL keyword of a SQL throttling rule. Range N/A |
| sql_type | String | Definition SQL type of a SQL throttling rule. Range
|
| database | String | Definition Database that a SQL throttling rule belongs to. Range N/A |
| avg_exec_time | Double | Definition Average execution time of a SQL throttling rule, in seconds. Range N/A |
| max_exec_time | Double | Definition Maximum execution time of a SQL throttling rule, in seconds. Range N/A |
| exec_count | Integer | Definition Number of times that a SQL throttling rule is executed. Range N/A |
Example Request
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/3d39c18788b54a919bab633874c159dfin14/limit-task/recommend-rule
{
"recommend_type": "all",
"recommend_count": 1,
"use_ops_tunnel": false
} Example Response
{
"recommend_rules": [
{
"recommend_type": "exec_count",
"sql_id": "3811675404",
"sql_model": "insert into t1 select generate_series($1,$2),md5(random()::text), md5(random()::text);",
"sql_keyword": "t1,generate_series,md5,random,text",
"sql_type": "INSERT",
"database": "test",
"avg_exec_time": 2232.495,
"max_exec_time": 2232.495,
"exec_count": 1
},
{
"recommend_type": "avg_exec_time",
"sql_id": "3811675404",
"sql_model": "insert into t1 select generate_series($1,$2),md5(random()::text), md5(random()::text);",
"sql_keyword": "t1,generate_series,md5,random,text",
"sql_type": "INSERT",
"database": "test",
"avg_exec_time": 2232.495,
"max_exec_time": 2232.495,
"exec_count": 1
},
{
"recommend_type": "max_exec_time",
"sql_id": "3811675404",
"sql_model": "insert into t1 select generate_series($1,$2),md5(random()::text), md5(random()::text);",
"sql_keyword": "t1,generate_series,md5,random,text",
"sql_type": "INSERT",
"database": "test",
"avg_exec_time": 2232.495,
"max_exec_time": 2232.495,
"exec_count": 1
}
],
"total_count": 3
} Status Codes
- Normal
- Abnormal
For details, see Status Codes.
Error Codes
For details, see Error Codes.
What is your overall rating for this page?
Thank 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