Obtaining SQL Diagnosis Results
Function
This API is used to obtain SQL diagnosis results.
Authorization Information
Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
das:clouddba:sqlDiagnosis
Read
Instance
-
-
-
URI
POST /v3/{project_id}/connections/{connection_id}/tuning/get-tuning-result
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value can contain 32 characters. Only letters and digits are supported. Default Value N/A |
| connection_id | Yes | String | Definition Connection ID established between a database account and the database. The database user ID is created using the API in Creating an Instance Connection. Constraints N/A Range The value is a UUID containing 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| message_id | Yes | String | Definition SQL diagnosis message ID created in Creating a SQL Diagnosis Task Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| tune_result | Table 4 Object | Definition Diagnosis result Range N/A |
| Parameter | Type | Description |
|---|---|---|
| message_id | String | Definition Diagnosis information ID Range N/A |
| status_code | String | Definition Diagnosis task status code Range 0000 |
| error_code | String | Definition Error code Range
|
| error_message | String | Definition Error message Range N/A |
| index_advice | Array of Table 5 objects | Definition Index tuning suggestion list Range N/A |
| tuning_advice | Array of Strings | Definition Statement tuning suggestion list Range N/A |
| formatted_sql | String | Definition Formatted SQL statement Range N/A |
| original_sql | String | Definition Original SQL statement Range N/A |
| explain | Array of Table 6 objects | Definition Execution plan Range N/A |
| tb_pos_infos | Array of Table 7 objects | Definition Table information identified in the SQL statement Range N/A |
| feedback_infos | Table 8 object | Definition Feedback Range N/A |
| Parameter | Type | Description |
|---|---|---|
| schema_name | String | Definition Schema name Range N/A |
| table_name | String | Definition Table name Range 0000 |
| index_name | String | Definition Index name Range N/A |
| columns | Array of Strings | Definition Column list Range N/A |
| unique | Boolean | Definition Unique Key Range N/A |
| track_id | String | Definition Trace ID Range N/A |
| quality | String | Definition SQL quality Range
|
| ddl_add_index | String | Definition Statement for adding an index Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition SQL execution ID Range N/A |
| select_type | String | Definition SELECT type Range
|
| table | String | Definition Table name Range N/A |
| type | String | Definition How MySQL finds rows in a table Range
|
| rows | Long | Definition Estimated number of rows to be scanned Range N/A |
| possible_keys | String | Definition Index that may be selected Range N/A |
| key | String | Definition Selected index Range N/A |
| filtered | Double | Definition Percentage of rows that are filtered based on table conditions Range N/A |
| key_len | String | Definition Number of bytes used in the index Range N/A |
| ref | String | Definition Column compared with the index Range N/A |
| extra | String | Definition Extra information Range N/A |
| Parameter | Type | Description |
|---|---|---|
| schema_name | String | Definition Schema name Range N/A |
| origin_name | String | Definition Original table name Range N/A |
| name | String | Definition Table name Range N/A |
| start | Integer | Definition Start position Range N/A |
| end | Integer | Definition End position Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Long | Definition Feedback message ID Range N/A |
| project_id | String | Definition Project ID Range N/A |
| message_id | String | Definition Diagnosis information ID Range N/A |
| feedback_grade | String | Definition Feedback level Range N/A |
| feedback_content | String | Definition Feedback content Range N/A |
| gmt_created | Long | Definition Feedback creation time Range N/A |
| gmt_modified | Long | Definition Feedback modification time Range N/A |
Example Requests
POST https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/connections/179e525e-0e9c-4dcc-9dd7-ee2f36121e23/tuning/get-tuning-result
{
"message_id": "692d5a7a0cf263510807db3b"
} Example Responses
Status code: 200
Success.
{
"tune_result": {
"message_id": "692d5a7a0cf263510807db3b",
"status_code": "0000",
"error_message": "Success",
"index_advice": [],
"tuning_advice": [
"No WHERE condition is specified for the outermost SELECT statement. More rows than expected may be returned."
],
"formatted_sql": "SELECT *\nFROM lbw",
"original_sql": "SELECT * FROM lbw",
"explain": [
{
"id": 1,
"select_type": "SIMPLE",
"table": "lbw",
"type": "ALL",
"rows": 1002,
"filtered": 100.0
}
],
"tb_pos_infos": [
{
"schema_name": "czh_test",
"origin_name": "lbw",
"name": "lbw",
"start": 14,
"end": 17
}
],
"feedback_infos": {}
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Success. |
| 400 | Client error. |
| 500 | Server error. |
Error Codes
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