DESCRIBE SESSION QUERIES¶
The DESCRIBE SESSION QUERIES
command outputs a list of queries per session, including queued queries.
A session is opened per connection or per Workbench tab.
Note
DESCRIBE
commands use CPU to increase usability.
Syntax¶
DESC[RIBE] SESSION QUERIES [SESSION ID '<sessionId>' | ALL] [STATUS IN (
{ QUEUED,
| EXECUTING,
| EXECUTION_SUCCEED,
| EXECUTION_FAILED,
| CLOSED,
| COMPILATION_FAILED,
| ABORTED,
| FETCHING_RESULTS,
| COMPILING,
| COMPLETE }
)]
Parameters¶
Parameter |
Parameter Type |
Description |
---|---|---|
|
The session ID of the query. If not specified the current session ID is provided |
|
|
Specifies that the operation should return results from all sessions. For users with |
|
|
A filter that allows you to specify a subset of statuses from the list provided (e.g., |
Output¶
Parameter |
Description |
Type |
---|---|---|
|
|
Displays the query ID |
|
|
Displays the query status |
|
|
Displays the query type |
|
|
Displays the defined SQL text from the specified query |
|
|
The role who executed the query |
|
|
Displays the session ID |
|
|
Displays query execution date and time |
|
|
Displays query end date and time |
|
|
Query duration time (milliseconds) |
|
|
Query time in queue (milliseconds) |
|
|
Query compilation time (milliseconds) |
|
|
The execution time (milliseconds) |
|
|
The total compute time is the period when the system is actively working, measured in milliseconds. If multiple workers are handling a query, the compute time might be longer than the time it takes to execute the query |
|
|
The number of rows read by the query |
|
|
The number of rows returned by the query |
|
|
The data size produced by the query (MegaBytes) |
|
|
The size of compressed read data (MegaBytes) |
|
|
The size of uncompressed read data (MegaBytes) |
|
|
Displays information about the client driver type and version |
|
|
The reason for query failure |
|
|
The resource pool used for executing the statement |
Example¶
DESCRIBE SESSION QUERIES SESSION ID '683256f5-66b7-4d8c-b1a2-456dddcb6dee';
Output:
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|query_id|query_status|query_type|sql_text |role |session_id |start_time |end_time |duration|time_in_queue|compilation_time|execution_time|total_compute_time |rows_read|rows produced|data produced|data_read_compressed|data_read_uncompressed|client_info |query_error|pool_name|
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|6 |COMPLETE |SELECT |SELECT * FROM MyTable ORDER BY salary DESC LIMIT 5 |[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:47:53|2024-01-11T10:47:55|2137 |0 |139 |1673 |0.56312761833333324634764949223608709871768951416015625 |50 |5 |245 |1624 | |SQream Node.js| |sqream |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|5 |COMPLETE |UPDATE |UPDATE MyTable SET salary = 55000 WHERE name = 'John'|[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:47:49|2024-01-11T10:47:51|1958 |0 |258 |789 |0.2553759140000000371628630091436207294464111328125 |50 |0 |0 |874 | |SQream Node.js| |sqream |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|4 |COMPLETE |SELECT |SELECT * FROM MyTable ORDER BY age DESC LIMIT 10000 |[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:47:46|2024-01-11T10:47:49|2417 |0 |114 |1727 |0.57934194233333347057168793980963528156280517578125 |50 |50 |1720 |1624 | |SQream Node.js| |sqream |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|3 |COMPLETE |SELECT |select 1 LIMIT 10000 |[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:47:44|2024-01-11T10:47:45|1373 |0 |122 |708 |0.33468688299999993507327644692850299179553985595703125 |0 |1 |65 |0 | |SQream Node.js| |BI |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|2 |COMPLETE |SELECT |SELECT AVG(salary) AS average_salary FROM MyTable|[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:47:04|2024-01-11T10:47:07|2738 |0 |476 |1764 |0.457902023999999963077556230928166769444942474365234375|50 |1 |72 |250 | |SQream Node.js| |BI |
| | | |LIMIT 10000 | | | | | | | | | | | | | | | | | |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
|1 |COMPLETE |SELECT |select * from mytable LIMIT 10000 |[email protected]|683256f5-66b7-4d8c-b1a2-456dddcb6dee|2024-01-11T10:46:56|2024-01-11T10:46:58|2481 |0 |202 |1694 |0.651208106333333258675111210322938859462738037109375 |50 |50 |1720 |1624 | |SQream Node.js| |sqream |
+--------+------------+----------+-----------------------------------------------------+---------------------+------------------------------------+-------------------+-------------------+--------+-------------+----------------+--------------+--------------------------------------------------------+---------+-------------+-------------+--------------------+----------------------+--------------+-----------+---------+
To list the Jobs session queries:
Go to Settings > Access Token Management and locate the Jobs connection Client Role.
Run the
DESCRIBE SESSION
statement using theUSER
parameter and the retrieved client role:
DESCRIBE SESSIONS USER "<jobs_client_role>";
From the
DESCRIBE SESSION
result set, copy the relevant session id.Run the
DESCRIBE SESSION QUERIES
statement using theSESSION ID
parameter and the retrieved session id.
Permissions¶
This command requires a CONNECT
permission.