Querying the SQL Template Comparison List
Function
This API is used to query the SQL template comparison list.
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:listTopSql
list
Instance
-
das:clouddba:topSqlList
-
URI
POST /v3/{project_id}/fullsql/query-sql-tpl-cmp-list
| 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 supported. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| instance_id | Yes | String | Definition Instance ID Constraints N/A Range The value can contain 32 characters. Only letters and digits are supported. Default Value N/A |
| node_id | No | String | Definition Node ID Constraints N/A Range The value can contain 32 characters. Only letters and digits are supported. Default Value N/A |
| start_at1 | Yes | Long | Definition Start time of comparison date 1, in milliseconds Constraints N/A Range N/A Default Value N/A |
| end_at1 | Yes | Long | Definition End time of comparison date 1, in milliseconds Constraints N/A Range N/A Default Value N/A |
| start_at2 | Yes | Long | Definition Start time of comparison date 2, in milliseconds Constraints N/A Range N/A Default Value N/A |
| end_at2 | Yes | Long | Definition End time of comparison date 2, in milliseconds Constraints N/A Range N/A Default Value N/A |
| operation | No | String | Definition Operation type Constraints Multiple values need to be separated by commas (,). Range N/A Default Value N/A |
| db_name_list | No | Array of Strings | Definition Database names Constraints N/A Range N/A Default Value N/A |
| keyword | No | String | Definition Keywords for fuzzy search Constraints N/A Range N/A Default Value N/A |
| sql_template_id | No | String | Definition SQL template ID Constraints N/A Range N/A Default Value N/A |
| sort | No | String | Definition Sorting field Constraints N/A Range
Default Value N/A |
| asc | No | Boolean | Definition Sorting order Constraints N/A Range
Default Value N/A |
| size | No | Integer | Definition Number of records queried at a time Constraints N/A Range N/A Default Value 30 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| sql_tpl_cmp_dto_list | Array of objects in Table 4 | Definition SQL template comparison list Range N/A |
| Parameter | Type | Description |
|---|---|---|
| sql_tpl_dto1 | Array of objects in Table 5 | Definition SQL template list of date 1 Range N/A |
| sql_tpl_dto2 | Array of objects in Table 5 | Definition SQL template list of date 2 Range N/A |
| is_new | Boolean | Definition Whether the data is newly added Range N/A |
| execute_time_increase | Boolean | Definition Whether the execution time increases Range N/A |
| lock_wait_increase | Boolean | Definition Whether the lock wait time increases Range N/A |
| Parameter | Type | Description |
|---|---|---|
| template_id | String | Definition SQL template ID Range N/A |
| sql_template | String | Definition SQL template Range N/A |
| sql_sample_string | String | Definition SQL example Range N/A |
| db_names | Arrays of Strings | Definition Database list Range N/A |
| sql_type | String | Definition SQL type Range N/A |
| execute_num | Long | Definition Execution times Range N/A |
| total_cost | Double | Definition Total execution time, in milliseconds Range N/A |
| avg_cost | Double | Definition Average execution duration, in milliseconds Range N/A |
| max_cost | Double | Definition Maximum execution duration, in milliseconds Range N/A |
| avg_rows_sent | Double | Definition Average rows returned Range N/A |
| max_rows_sent | Double | Definition Maximum rows returned Range N/A |
| avg_rows_affected | Double | Definition Average rows affected Range N/A |
| max_rows_affected | Double | Definition Maximum rows affected Range N/A |
| avg_lock_time | Double | Definition Average lock wait time Range N/A |
| max_lock_time | Double | Definition Maximum lock wait time Range N/A |
| total_rows_examined | Double | Definition Average rows scanned Range N/A |
| max_rows_examined | Double | Definition Maximum rows scanned Range N/A |
| total_cost_ratio | String | Definition Execution duration ratio Range N/A |
| total_examined_ratio | String | Definition Percentage of scanned rows Range N/A |
| execute_num_ratio | String | Definition Percentage of execution times Range N/A |
Example Requests
POST https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/fullsql/query-sql-tpl-cmp-list
{
"start_at1": 1764149096000,
"end_at1": 1764152696000,
"start_at2": 1764235496000,
"end_at2": 1764239096000,
"sort": "avgCost",
"asc": false,
"instance_id": "bcfa975193f1402fa11a6d4fd6baf5fbin01",
"operation": "",
"db_name_list": [],
"keyword": "",
"size": 50
} Example Responses
Status code: 200
Success.
{
"sql_tpl_cmp_dto_list": [
{
"execute_time_increase": false,
"lock_wait_increase": false,
"sql_tpl_dto2": {
"template_id": "49C5B3D3D29FE1AA",
"sql_template": "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME\nFROM information_schema.schemata\nORDER BY SCHEMA_NAME\nLIMIT ?",
"sql_sample_string": "/* sql from das */select SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME from information_schema.schemata order by SCHEMA_NAME limit 1000",
"db_names": [],
"sql_type": "select",
"db_name": "",
"execute_num": 2,
"total_cost": 27.0,
"avg_cost": 13.5,
"max_cost": 15.0,
"avg_rows_sent": 83.0,
"max_rows_sent": 83.0,
"avg_rows_affected": 0.0,
"max_rows_affected": 0.0,
"avg_lock_time": 0.0,
"max_lock_time": 0.0,
"total_rows_examined": 332.0,
"avg_rows_examined": 166.0,
"max_rows_examined": 166.0,
"tunable": false,
"total_cost_ratio": "31.76%",
"total_examined_ratio": "18.53%",
"execute_num_ratio": "1.60%"
},
"new": true
}
]
} 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