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.

Permissions

The role must have the SUPERUSER permissions.

Syntax

show_server_status_statement ::=
    SELECT SHOW_SERVER_STATUS()
    ;

Parameters

None

Returns

This function returns a list of active sessions. If no sessions are active across the cluster, the result set will be empty.

Result columns

service

The service name for the statement

instance

The worker ID

connection_id

Connection ID

serverip

Worker end-point IP

serverport

Worker end-point port

database_name

Database name for the statement

user_name

Username running the statement

clientip

Client IP

statementid

Statement ID

statement

Statement text

statementstarttime

Statement start timestamp

statementstatus

Statement status (see table below)

statementstatusstart

Last updated timestamp

Statement status values

Status

Description

Preparing

Statement is being prepared

In queue

Statement is waiting for execution

Initializing

Statement has entered execution checks

Executing

Statement is executing

Stopping

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.

Examples

Using SHOW_SERVER_STATUS to get statement IDs

t=> SELECT SHOW_SERVER_STATUS();
service | instanceid | connection_id | serverip     | serverport | database_name | user_name  | clientip    | statementid | statement                   | statementstarttime  | statementstatus | statementstatusstart
--------+------------+---------------+--------------+------------+---------------+------------+-------------+-------------+-----------------------------+---------------------+-----------------+---------------------
sqream  |            |           102 | 192.168.1.91 |       5000 | t             | rhendricks | 192.168.0.1 |         128 | SELECT SHOW_SERVER_STATUS() | 24-12-2019 00:14:53 | Executing       | 24-12-2019 00:14:53

The statement ID is 128, running on worker 192.168.1.91.