On a secure cluster, this area of the DB Console can only be accessed by a SQL user with the
VIEWACTIVITY role option. Non-
admin users will see only their own sessions, while
admin users see sessions for all users.
The Sessions page of the DB Console provides details of all open sessions in the cluster.
To view this page, click SQL Activity in the left-hand navigation of the DB Console. Click the Sessions tab.
Use the Sessions table to see the open sessions in the cluster. This table includes active and idle sessions. A session is active if it has an open transaction (including implicit transactions, which are individual SQL statements), and idle if it has no open transaction. Active sessions consume hardware resources.
New in v22.1: To filter the sessions, click the Filters field.
To filter by application, select App and choose one or more applications.
- Queries from the SQL shell are displayed under the
- If you haven't set
application_namein a client connection string, it appears as
To filter by session duration, specify the session time and unit.
New in v22.1: Click to select the columns to display in the table.
The following are displayed for each session:
|Session Start Time (UTC)||New in v22.1: The timestamp at which the session started.|
|Session Duration||The amount of time the session has been open.|
|Status||The status of the session: Active or Idle. A session is Active if it has an open explicit or implicit transaction (individual SQL statement) with a statement that is actively running or waiting to acquire a lock. A session is Idle if it is not executing a statement.|
|Most Recent Statement||New in v22.1: If more than one statement is executing, the most recent statement. If the session is Idle, the last statement.|
|Statement Start Time (UTC)||New in v22.1: The timestamp at which the statement started.|
|Memory Usage||Amount of memory currently allocated to the session followed by the maximum amount of memory the session has ever been allocated.|
|Client IP Address||New in v22.1: The IP address and port of the client that opened the session.|
|User Name||New in v22.1: The user that opened the session.|
|Application Name||New in v22.1: The application that ran the session.|
|Actions||Options to cancel the active statement and cancel the session. These require the
To view details of a session, click a Session Start Time (UTC) to display session details.
If a session is idle, the Transaction and Most Recent Statement panels will display No Active [Transaction | Statement].
The Cancel statement button ends the SQL statement. The session running this statement will receive an error. The Cancel session button ends the session. The client that holds this session will receive a "connection terminated" event.
- Session Start Time shows the timestamp at which the session started.
- Gateway Node shows the node ID and IP address/port of the gateway node handling the client connection.
- Application Name New in v22.1: shows the name of the application connected to the session.
- Client IP Address shows the IP address/port of the client that opened the session.
- Memory Usage shows the amount of memory currently allocated to this session, followed by the maximum amount of memory this session has ever allocated.
- User Name New in v22.1: displays the name of the user that started the session.
Transaction displays the following information for an open transaction.
- Transaction Start Time shows the timestamp at which the transaction started.
- Number of Statements Executed shows the total number of SQL statements executed by the transaction.
- Number of Retries shows the total number of retries for the transaction.
- Number of Automatic Retries shows the total number of automatic retries run by CockroachDB for the transaction.
- Read Only? shows whether the transaction is read-only.
- AS OF SYSTEM TIME? shows whether the transaction uses
AS OF SYSTEM TIMEto return historical data.
- Priority shows the priority for the transaction.
- Memory Usage shows the amount of memory currently allocated to this transaction, followed by the maximum amount of memory this transaction has ever allocated.
Most Recent Statement displays the following information for an active statement.
- The SQL statement.
- Execution Start Time is the timestamp at which the statement was run.
- Distributed Execution? shows whether the statement uses Distributed SQL (DistSQL) optimization.
- Statements page
- SQL Statements