Exporting SQL Execution Time Distribution
Function
This API is used to export the SQL execution duration after the TopSQL switch is turned on. This function is available only for paid instances. The maximum query interval is six hours.
URI
GET /v3/{project_id}/instances/{instance_id}/top-sql-trend
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. To obtain this value, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_at |
Yes |
Long |
Start time in Unix timestamp format, in milliseconds. |
end_at |
Yes |
Long |
End time in Unix timestamp format, in milliseconds. |
datastore_type |
Yes |
String |
Database type, which can be MySQL and TaurusDB |
node_id |
No |
String |
Node ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
X-Language |
No |
String |
Request language type. Enumerated values:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
interval_millis |
Long |
Interval between two time points in the list. The query interval is 10s within one hour, 60s from one hour to six hours, and 300s within more than six hours. The unit is millisecond. |
top_sql_trend_items |
Array of TopSqlTrendItem objects |
SQL execution time distribution. |
total_count |
Integer |
Total execution time ranges. |
Parameter |
Type |
Description |
---|---|---|
execute_at |
Long |
Execution time point in milliseconds. The time range for statistics is collected from execute_at - interval_millis to execute_at. |
query_time_in_100ms |
Long |
Execution duration less than 100 ms. |
query_time_in_500ms |
Long |
Execution duration from 100 ms to 500 ms. |
query_time_in_1s |
Long |
Execution duration from 500 ms to 1000 ms. |
query_time_over_1s |
Long |
Execution duration more than 1000 ms. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Example Request
Exporting SQL execution time distribution
GET https://das.cn-north-1.myhuaweicloud.com/v3/054c630ff780d4cc2f40c00d7f6fb21d/instances/6243b3fcf2f948578d46ed4c52fb54eein01/top-sql-trend?start_at=1611975464337&end_at=1611979064337&datastore_type=MySQL&node_id=fec05693c76c4f389561051db430324cno01
Example Response
Status code: 200
Success
{ "top_sql_trend_items" : [ { "execute_at" : 1666702330000, "query_time_over_1s" : 1, "query_time_in_100ms" : 3, "query_time_in_1s" : 0, "query_time_in_500ms" : 0 }, { "execute_at" : 1666702340000, "query_time_over_1s" : 2, "query_time_in_100ms" : 2, "query_time_in_1s" : 0, "query_time_in_500ms" : 0 } ], "interval_millis" : 10000, "total_count" : 2 }
Status Codes
Status Code |
Description |
---|---|
200 |
Success |
400 |
Client error |
500 |
Server error |
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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