46.1. User Sessions #

You can view information about user sessions and background worker processes of an instance. The information is based on the pg_stat_activity view.

46.1.1. Viewing User Sessions #

Go to user sessions in one of the following ways:

  • Using the monitoring section:

    1. In the navigation panel, go to MonitoringActivity.

    2. In the top-right corner of the page, select the instance.

  • Using the configuration section of an instance:

    1. In the navigation panel, go to InfrastructureInstances.

    2. Click the name of the instance.

    3. In the navigation panel, go to Activity.

The table of user sessions with the following columns will be displayed:

  • pid: The backend ID.

  • leader_pid: The backend ID for the process in the parallel query execution group.

  • backend_type: The type of the backend.

    For more information about possible values, refer to the official Postgres Pro documentation on the pg_stat_activity module (refer to the backend_type column).

  • backend_start: The backend start date and time.

  • client_hostname, client_addr, and client_port: The network name, address, and port number of the client that initiated the user session.

  • usesysid: The ID of the DBMS user on behalf of which the session is initiated.

  • username: The name of the DBMS user on behalf of which the session is initiated.

  • datid: The ID of the database associated with the user session.

  • database: The name of the database associated with the user session.

  • application_name: The name of the source application of the user session.

  • state: The state of the backend.

    For more information about possible values, refer to the official Postgres Pro documentation on the pg_stat_activity view (refer to the state column).

  • wait_event_type: The type of the wait event for the backend.

    For more information, refer to the official Postgres Pro documentation on the pg_stat_activity module (refer to wait_event_type and wait_event columns).

  • wait_event: The name of the wait event for the backend.

  • transaction_duration_seconds: The duration of the current backend transaction, in seconds.

  • xact_start: The start date and time of the current backend transaction.

  • query_duration_seconds: The duration of the current backend query in seconds.

  • query_start: The start date and time of the current backend query.

  • state_change: The date and time of the last backend state update (refer to the state column).

  • backend_xid: The ID of the backend top-level transaction.

  • backend_xmin: The current xmin bound of the backend.

  • query_id: The ID of the current or last backend query.

  • query: The text of the current or last backend query.

  • Actions.

    For more information about available actions, refer to the corresponding instructions.

46.1.2. Viewing the Current Backend Query Plan #

You can view the current backend query plan if the pg_query_state module is installed.

To view the current backend query plan:

  1. Go to user sessions in one of the following ways:

    • Using the monitoring section:

      1. In the navigation panel, go to MonitoringActivity.

      2. In the top-right corner of the page, select the instance.

    • Using the configuration section of an instance:

      1. In the navigation panel, go to InfrastructureInstances.

      2. Click the name of the instance.

      3. In the navigation panel, go to Activity.

  2. Click Open active query plan next to the user session.

Query and Query plan blocks will be displayed. You can perform the following actions in the top-right corner of these blocks:

  • To copy the query or its plan, click Copy.

  • To visualize the query plan, click Visualize.

46.1.3. Canceling the Current Backend Query #

Canceling a current backend query does not terminate a user session.

To cancel the current backend query:

  1. Go to user sessions in one of the following ways:

    • Using the monitoring section:

      1. In the navigation panel, go to MonitoringActivity.

      2. In the top-right corner of the page, select the instance.

    • Using the configuration section of an instance:

      1. In the navigation panel, go to InfrastructureInstances.

      2. Click the name of the instance.

      3. In the navigation panel, go to Activity.

  2. Click Abort query next to the user session.

  3. Click Execute.

46.1.4. Terminating a User Session #

When the user session is terminated, the current backend query is canceled automatically.

To terminate a user session:

  1. Go to user sessions in one of the following ways:

    • Using the monitoring section:

      1. In the navigation panel, go to MonitoringActivity.

      2. In the top-right corner of the page, select the instance.

    • Using the configuration section of an instance:

      1. In the navigation panel, go to InfrastructureInstances.

      2. Click the name of the instance.

      3. In the navigation panel, go to Activity.

  2. Click Three vertical dots iconTerminate session next to the user session.

  3. Click Execute.

46.1.5. Running Backend Diagnostics #

For more information about backend diagnostics, refer to Chapter 47.

Before performing this instruction, configure backend diagnostics.

To run backend diagnostics:

  1. Go to user sessions in one of the following ways:

    • Using the monitoring section:

      1. In the navigation panel, go to MonitoringActivity.

      2. In the top-right corner of the page, select the instance.

    • Using the configuration section of an instance:

      1. In the navigation panel, go to InfrastructureInstances.

      2. Click the name of the instance.

      3. In the navigation panel, go to Activity.

  2. Click Three vertical dots iconRun diagnostics next to the user session.

46.1.6. Viewing the Current Backend Query Locks #

  1. Go to user sessions in one of the following ways:

    • Using the monitoring section:

      1. In the navigation panel, go to MonitoringActivity.

      2. In the top-right corner of the page, select the instance.

    • Using the configuration section of an instance:

      1. In the navigation panel, go to InfrastructureInstances.

      2. Click the name of the instance.

      3. In the navigation panel, go to Activity.

  2. Click Three vertical dots iconOpen lock tree next to the user session.