Session management

Updated at:

PolarDB for MySQL quick diagnostics integrates some Database Autonomy Service (DAS) capabilities. Use session management to view session statistics for an instance.

Procedure

  1. Log in to the PolarDB console

  2. In the upper-left corner, select the region where the cluster is deployed.

  3. On the Clusters page, click the ID of the target cluster.

  4. In the left-side navigation pane, choose Diagnostics and Optimization > Quick Diagnostics.

  5. Click the Sessions tab.

  6. On the Sessions page, view details on the Instance Sessions and Session Statistics tabs.

    • Instance Sessions: Displays current sessions with key metrics such as exception count, active session count, maximum execution time, CPU utilization, and connection utilization. Available actions: Enable Auto Refresh, Export Session List, End All Sessions, and History of Ended Sessions. The session table lists details including ID, User, Host, Database, Command, Execution Time (s), State, SQL, and Transaction Duration (s).

      State field description

      The State field displayed in the session management console corresponds to the information_schema.processlist system table's STATE column. You can run the following SQL statement to query session state information consistent with the console:

      SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE FROM information_schema.processlist;

      Common state values include:

      State

      Description

      NULL

      The session is idle (Sleep command).

      User sleep

      The session is executing a SLEEP function.

      executing

      A query is being executed.

      Sending data

      The session is sending query result data to the client.

      Waiting on empty queue

      The session is waiting on a task queue. This state typically appears in event scheduler (event_scheduler) sessions.

      This field corresponds one-to-one to the State column displayed in the console. You can also directly query information_schema.processlist by using SQL to obtain the same information.

      Note
      • If an abnormal parameter session occurs during an SQL request, select the session and click Kill Selected or Optimize Selected Sessions to analyze and configure the session.

      • Click 10s SQL Analysis in the upper-right corner to view the most frequently executed SQL statements and slow queries within a 10-second period. 10-second SQL analysis10-second SQL analysis.

      • Click SQL throttling to limit database requests and SQL concurrency for service availability. SQL throttlingSQL throttling.

    • Session Statistics: Displays session counts and durations grouped by dimension. Four sections: Overview (total sessions, running sessions, longest runtime among running sessions), By User (by database user), By Source (by client IP), and By Database (by database name). Each section shows active and total counts.

Best practices

High CPU utilization for PolarDB for MySQL

PolarDB proxy configuration and traffic anomalies

PolarDB deadlock