Querying SQL Execution Information
Function
This API is used to query SQL execution information.
Calling Method
For details, see Calling APIs.
URI
GET /v1/{project_id}/clusters/{cluster_id}/dms/queries/{query_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition Project ID. To obtain the value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
cluster_id |
Yes |
String |
Definition Cluster ID. For details about how to obtain the value, see Obtaining the Cluster ID. Constraints The value must be a valid DWS cluster ID. Range It is a 36-digit UUID. Default Value N/A |
query_id |
Yes |
String |
Definition Query ID. Constraints N/A Range N/A Default Value N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ctime |
No |
Long |
Definition Collection time, which is a timestamp. Constraints N/A Range N/A Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
code |
Integer |
Definition Response code. Range N/A |
msg |
String |
Definition Response information. Range N/A |
data |
ListQueriesDto object |
Definition Response data. Range N/A |
Parameter |
Type |
Description |
---|---|---|
virtual_cluster_id |
Integer |
Definition Virtual cluster ID. Range N/A |
ctime |
Long |
Definition Collection time. Range N/A |
pid |
String |
Definition Session ID. Range N/A |
inst_name |
String |
Definition Instance name. Range N/A |
waiting |
Boolean |
Definition Whether the backend is currently waiting on a lock. If yes, the value is true. Range N/A |
enqueue |
String |
Definition Resource status. Range N/A |
warning |
String |
Definition Warnings and warnings related to SQL self-diagnosis tuning. Range N/A |
query |
String |
Definition Query statement. Range N/A |
lane |
String |
Definition Fast or slow lane. Range fast: fast lane slow: slow lane. |
db_name |
String |
Definition Database name. Range N/A |
priority |
String |
Definition Priority of a task in the resource pool. Range 1: highest 2: high 4: medium 8: low |
query_id |
String |
Definition Internal query ID used for statement execution. Range N/A |
query_band |
String |
Definition Job type, which can be set using the GUC parameter query_band. The default value is an empty string. Range N/A |
job_name |
String |
Definition The value is obtained from the query_band field. The position is 0. Range N/A |
job_inst |
String |
Definition The value is obtained from the query_band field. The position is 1. Range N/A |
user_name |
String |
Definition Username used for connecting to the backend. Range N/A |
application_name |
String |
Definition Name of the application that is connected to the backend. Range N/A |
client_address |
String |
Definition IP address of the client connected to the backend. Range N/A |
client_hostname |
String |
Definition Host name of the client. Range N/A |
client_port |
String |
Definition TCP port number used by a client to communicate with the backend. Range N/A |
start_time |
Long |
Definition Time when the statement starts to be executed. Range N/A |
block_time |
Long |
Definition Block time before the statement is executed, in ms Range N/A |
duration |
Long |
Definition Duration that a statement has been executed, in ms. Range N/A |
estimate_total_time |
Long |
Definition Estimated execution time of a statement, in ms. Range N/A |
estimate_left_time |
Long |
Definition Estimated remaining time of statement execution, in ms. Range N/A |
resource_pool |
String |
Definition Resource pool used by the user. Range N/A |
control_group |
String |
Definition Cgroup used by the statement. Range N/A |
min_peak_memory |
Integer |
Definition Minimum memory peak of a statement across all DNs, in MB. Range N/A |
max_peak_memory |
Integer |
Definition Maximum memory peak of a statement across all DNs, in MB. Range N/A |
average_peak_memory |
Integer |
Definition Average memory usage during statement execution, in MB. Range N/A |
memory_skew_percent |
Integer |
Definition Memory usage skew of a statement among DNs. Range N/A |
estimate_memory |
Integer |
Definition Estimated memory used by a statement, in MB. Range N/A |
spill_info |
String |
Definition Statement spill information on all DNs. Range N/A |
min_spill_size |
Integer |
Definition Minimum spilled data among all DNs when a spill occurs, in MB. The default value is 0. Range N/A |
max_spill_size |
Integer |
Definition Maximum spilled data among all DNs when a spill occurs, in MB. The default value is 0. Range N/A |
average_spill_size |
Integer |
Definition Average spilled data among all DNs when a spill occurs, in MB. The default value is 0. Range N/A |
spill_skew_percent |
Integer |
Definition DN spill skew when a spill occurs. Range N/A |
min_dn_time |
Long |
Definition Minimum execution time of a statement across all DNs, in ms. Range N/A |
max_dn_time |
Long |
Definition Maximum execution time of a statement across all DNs, in ms. Range N/A |
average_dn_time |
Long |
Definition Average execution time of a statement across all DNs, in ms. Range N/A |
dntime_skew_percent |
Integer |
Definition Execution time skew of a statement among DNs. Range N/A |
min_cpu_time |
Long |
Definition Minimum CPU time of a statement across all DNs, in ms. Range N/A |
max_cpu_time |
Long |
Definition Maximum CPU time of a statement across all DNs, in ms. Range N/A |
total_cpu_time |
Long |
Definition Total CPU time of a statement across all DNs, in ms. Range N/A |
cpu_skew_percent |
Integer |
Definition CPU time skew of a statement among DNs. Range N/A |
average_peak_iops |
Integer |
Definition Average IOPS peak of a statement across all DNs. It is counted by ones in a column-store table and by ten thousands in a row-store table. Range N/A |
iops_skew_percent |
Integer |
Definition I/O skew of a statement among DNs. Range N/A |
max_peak_iops |
Integer |
Definition Maximum IOPS peak of a statement across all DNs. It is counted by ones in a column-store table and by ten thousands in a row-store table. Range N/A |
min_peak_iops |
Integer |
Definition Minimum IOPS peak of a statement across all DNs. It is counted by ones in a column-store table and by ten thousands in a row-store table. Range N/A |
query_plan |
String |
Definition Query plan. Range N/A |
query_status |
String |
Definition Status of the current query statement in real time. Range active, idle, idle in transaction, idle in transaction(aborted), fastpath function call, or disabled |
wlm_status |
String |
Definition Status of the current query statement in the resource pool. Range pending running finished aborted active unknown |
wlm_attrib |
String |
Definition Statement attribute. Range ordinary simple complicated internal |
system_query |
Boolean |
Definition Whether the query is a system query. Range N/A |
backend_start |
Long |
Definition Time when this process was started, that is, when the client connected to the server. Range N/A |
elapsed_time |
Long |
Definition Execution time so far. Range N/A |
curr_xact_start |
Long |
Definition Time when the current transaction was started (NULL if no transactions are active) If the current query is the first of its transaction, this column is equal to the query_start column. Range N/A |
state_change |
Long |
Definition Time when the last status was changed. Range N/A |
query_start |
Long |
Definition Time when the statement starts to be executed. Range N/A |
query_elapsed_time |
Long |
Definition Actual execution duration of the statement, in seconds. Range N/A |
Example Requests
https://{Endpoint}/v1/{project_id}/clusters/{cluster_id}/dms/queries/{query_id}?ctime=1699062846000
Example Responses
Status code: 200
Query succeeded.
{ "code" : 0, "msg" : "OK", "data" : { "ctime" : 1699062846000, "pid" : "140535026615872", "waiting" : false, "duration" : 0, "enqueue" : "", "warning" : "", "query" : "WLM fetch collect info from data nodes", "lane" : "", "priority" : null, "virtual_cluster_id" : 0, "inst_name" : "cn_5002", "db_name" : "postgres", "query_id" : "145522562959855061", "query_band" : "", "job_name" : "", "job_inst" : "", "user_name" : "Ruby", "application_name" : "workload", "client_address" : "", "client_hostname" : "", "client_port" : "", "start_time" : 0, "block_time" : 0, "estimate_total_time" : 0, "estimate_left_time" : 0, "resource_pool" : "default_pool", "control_group" : "", "min_peak_memory" : 0, "max_peak_memory" : 0, "average_peak_memory" : 0, "memory_skew_percent" : 0, "estimate_memory" : 0, "spill_info" : "", "min_spill_size" : 0, "max_spill_size" : 0, "average_spill_size" : 0, "spill_skew_percent" : 0, "min_dn_time" : 0, "max_dn_time" : 0, "average_dn_time" : 0, "dntime_skew_percent" : 0, "min_cpu_time" : 0, "max_cpu_time" : 0, "total_cpu_time" : 0, "cpu_skew_percent" : 0, "average_peak_iops" : 0, "iops_skew_percent" : 0, "max_peak_iops" : 0, "min_peak_iops" : 0, "query_plan" : "", "query_status" : "active", "wlm_status" : "", "wlm_attrib" : "", "system_query" : false, "backend_start" : 0, "elapsed_time" : 0, "curr_xact_start" : 0, "state_change" : 0, "query_start" : 0, "query_elapsed_time" : 0 } }
Status Codes
Status Code |
Description |
---|---|
200 |
Query succeeded. |
400 |
Request error. |
401 |
Authentication failed. |
403 |
You do not have required permissions. |
404 |
No resources found. |
500 |
Internal server error. |
503 |
Service unavailable. |
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