Updated on 2025-08-08 GMT+08:00

Managing Real-Time Sessions

Scenarios

You can query session snapshots of your instance while sorting, filtering, and displaying the snapshots as needed. You can filter and identify the desired slow SQL sessions and active sessions by user, host, and database. Sessions can be killed for urgent instance recovery to ensure database availability.

Precautions

Killing a session may cause service disconnection. Your applications should be able to reconnect to the instance.

Procedure

  1. Click in the upper left corner and select a region.
  2. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  3. On the Instances page, click the DB instance name.
  4. In the navigation pane, choose DBA Assistant > Real-Time Diagnosis.
  5. Click the Sessions tab. You can perform the following operations on this tab page:

    • Viewing session statistics

      In the sessions statistics, you can view statistics on the slow sessions, active sessions, total sessions, long transaction sessions by user, access host, and database.

      Figure 1 Sessions
    • Setting a slow session threshold
      Click next to the Slow Session Threshold field. In the displayed dialog box, set a slow session threshold and click OK. Sessions whose execution durations are greater than this threshold are automatically displayed.
      Figure 2 Setting a slow session threshold
    • Killing abnormal sessions

      In the session list, you can view session details. You can also select the abnormal session you want to end and click Kill Session to recover the database.

      A maximum of 100 sessions can be killed at a time.

      Figure 3 Killing a session
    • Configuring SQL throttling

      In the session list, click SQL Throttling and set the SQL type and keyword to match SQL statements. When the number of matched SQL statements exceeds the configured upper limit, the DB instance will refuse to execute the SQL statements, thus ensuring the instance stability.

      For details, see Creating a SQL Throttling Rule.

    • Creating lock analysis

      To create a lock analysis task, log in to the DB instance on the Locks & Transactions page first. For details, see Managing Locks & Transactions. Then, click Create Lock Analysis. A lock analysis record is generated, which is used to check whether there are any sessions that hold locks.

    • Exporting the session list

      Click Export to export all or specified sessions.