Sessions Page

On this page Carat arrow pointing down
Warning:
As of May 16, 2023, CockroachDB v21.2 is no longer supported. For more details, refer to the Release Support Policy.
Note:

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.

Sessions table

Use the Sessions table to see active, idle, and closed 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. A session is closed if it has closed the connection to CockroachDB.

Sessions Page

Note:

An active session can have an open transaction that is not currently running SQL. In this case, the Statement and Statement Duration columns will display N/A and Transaction Duration will display a value. Transactions that are held open can cause contention.

The following are displayed for each active session:

Column Description
Session Duration Amount of time the session has been open.
Transaction Duration Amount of time the transaction has been active, if there is an open transaction. If a session is idle, this column will display N/A.
Statement Duration Amount of time the SQL statement has been active, if there is an active statement. If a session is idle, this column will display N/A.
Memory Usage Amount of memory currently allocated to the session followed by the maximum amount of memory the session has ever been allocated.
Statement Active SQL statement. If a session is idle, this column will display N/A.
Actions Options to terminate the active statement and terminate the session. These require the CANCELQUERY role option.
  • Terminate Statement: Ends the SQL statement. The session running this statement will receive an error.
  • Terminate Session: Ends the session. The client that holds this session will receive a "connection terminated" event.
Tip:

Sort by Transaction Duration to display all active sessions at the top.

To view details of a session, click Session Duration.

Session details

Sessions Details Page

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 details
    • 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.
    • Client 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.
  • 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.
    • Priority shows the priority for the transaction.
    • Read Only? shows whether the transaction is read-only.
    • AS OF SYSTEM TIME? shows whether the transaction uses AS OF SYSTEM TIME to return historical data.
    • Memory Usage shows the amount of memory currently allocated to this transaction, followed by the maximum amount of memory this transaction has ever allocated.
  • Statement displays the following information for an active statement.
    • The SQL statement.
    • Execution Start Time the timestamp at which the statement was run.
    • Distributed Execution? whether the statement uses Distributed SQL (DistSQL) optimization.
    • View Statement Details to view the Statement Details page for the statement.

See also


Yes No
On this page

Yes No