SHOW_SERVER_STATUS
SHOW_SERVER_STATUS
returns a list of active sessions across the cluster.
To list active statements on the current worker only, see SHOW_CONNECTIONS.
Syntax
The following is the correct syntax when showing your server status:
SELECT SHOW_SERVER_STATUS()
Parameters
The Parameters section is not relevant for the SHOW_SERVER_STATUS
statement.
Returns
The SHOW_SERVER_STATUS
function returns a list of active sessions. If no sessions are active across the cluster, the result set will be empty.
The following table shows the SHOW_SERVER_STATUS
result columns;
service |
Statement Service Name |
---|---|
|
Shows the worker ID. |
|
Shows the connection ID. |
|
Shows the worker end-point IP. |
|
Shows the worker end-point port. |
|
Shows the statement’s database name. |
|
Shows the username running the statement. |
|
Shows the client IP. |
|
Shows the statement ID. |
|
Shows the statement text. |
|
Shows the statement start timestamp. |
|
Shows the statement status (see table below). |
|
Shows the most recently updated timestamp. |
The following table shows the statement status values:
Status |
Description |
---|---|
|
The statement is being prepared. |
|
The statement is waiting for execution. |
|
The statement has entered execution checks. |
|
The statement is executing. |
|
The statement is in the process of stopping. |
Notes
This utility shows the active sessions. Some sessions may be actively connected, but not running any statements.
Example
Using SHOW_SERVER_STATUS to Get Statement IDs
The following example shows how to use the SHOW_SERVER_STATUS
statement to get statement IDs:
SELECT SHOW_SERVER_STATUS();
service | instanceid | connection_id | serverip | serverport | database_name | user_name | clientip | statementid | statement | statementstarttime | statementstatus | statementstatusstart
--------+------------+---------------+---------------+------------+---------------+------------------+---------------+-------------+-------------------------------------------------------------------------------------------------------+---------------------+-----------------+---------------------
sqream | sqream_2 | 19 | 192.168.0.111 | 5000 | master | etl | 192.168.0.011 |2484923 | SELECT t1.account, t1.msisd from table a t1 join table b t2 on t1.id = t2.id where t1.msid='123123'; | 2022-01-17 16:19:31 | Executing | 2022-01-17 16:19:32
sqream | sqream_1 | 2 | 192.168.1.112 | 5000 | master | etl | 192.168.1.112 |2484924 | select show_server_status(); | 2022-01-17 16:19:39 | Executing | 2022-01-17 16:19:39
sqream | None | 248 | 192.168.1.112 | 5007 | master | maintenance_user | 192.168.1.112 |2484665 | select * from sqream_catalog.tables; | 2022-01-17 15:55:01 | In Queue | 2022-01-17 15:55:02
The statement ID is 128
, running on worker 192.168.1.91
.
Permissions
The role must have the SUPERUSER
permissions.