PolarDB for MySQL quick diagnostics integrates some Database Autonomy Service (DAS) capabilities. Use the session management feature to view the session statistics of a target instance.
Procedure
-
Log in to the PolarDB console。
-
In the upper-left corner, select the region where the cluster is deployed.
On the Clusters page, click the ID of the target cluster.
In the left-side navigation pane, choose .
-
Click the Sessions tab.
-
On the Sessions page, you can view the details of Instance Sessions and Session Statistics.
-
Instance Sessions: Displays current instance session information such as abnormal sessions, active sessions, and CPU utilization. The Instance Sessions page displays statistics at the top, including the number of exceptions, the number of active sessions, the maximum execution time, CPU utilization, and connection utilization. The page provides the Enable Auto Refresh and Export Session List function buttons, and the End All Sessions and History of Ended Sessions action buttons. The session list is displayed as a table with columns such as ID, User, Host, Database, Command, Execution Time (s), State, SQL, and Transaction Duration (s).
State field description
The State field displayed on the session management page of the console corresponds to the
information_schema.processlistsystem table'sSTATEcolumn. Run the following SQL statement to query session state information that is consistent with the console:SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE FROM information_schema.processlist;The following table describes common state values:
State value
Meaning
NULLThe session is idle and the command is Sleep.
User sleepThe session is running the SLEEP function.
executingThe session is running a query.
Sending dataThe session is sending query result data to the client.
Waiting on empty queueThe session is waiting on a task queue, which typically occurs in event scheduler (event_scheduler) sessions.
This field corresponds one-to-one with the State column displayed in the console. You can also query
information_schema.processlistdirectly by using SQL to get the same information.Note-
When you run an SQL request and an abnormal parameter session appears, select the current abnormal session and click Kill Selected or Optimize Selected Sessions to analyze and configure the abnormal session.
-
In the upper-right corner of the page, click the 10s SQL Request button to view the SQL statements with the most executions within 10 seconds and whether slow SQL statements exist. For details, see 10-second SQL analysis10-second SQL analysis.
-
Click the SQL throttling button to control database request volume and SQL concurrency, ensuring service availability. For details, see SQL throttlingSQL throttling.
-
-
Session Statistics: Displays the total number of sessions and session durations, and aggregates session counts by different dimensions such as user. The Session Statistics page contains four sections: Overview (total sessions, running sessions, and the longest running session duration), By User (aggregated by database user), By Source (aggregated by client IP), and By Database (aggregated by database name). Each section shows the active count and the total count.
-