tencent cloud

Viewing Real-Time Sessions
Last updated: 2025-07-09 14:52:25
Viewing Real-Time Sessions
Last updated: 2025-07-09 14:52:25
By viewing the Real-Time Session page, you can focus on real-time SQL statistics, session statistics, active sessions, performance monitoring data, and trends (including CPU utilization, running threads, and connected threads performance metrics). This helps Ops personnel and management personnel manage instance sessions and efficiently locate logic issues about database session connections that are difficult to detect manually.

Operations

1. Log in to the DBbrain console.
2. In the left sidebar, choose Diagnosis and Optimization.
3. At the top of the page, select the database type and instance ID, and select the Real-Time Session tab.
4. Select the page refresh frequency. You can select 5 seconds, 15 seconds, and 30 seconds. The default value is 15 seconds. You can also stop refreshing.
5. View SQL statistics, session statistics, active sessions, and performance monitoring information.
Note:
SQL statistics and session statistics are consistent with the active session data below.
5.1 View SQL statistics
Select the SQL Statistics tab, and select the statistics items (including execution count, total duration, maximum execution time, and average execution time) to view real-time statistics of SQL statements in different dimensions.

You can click SQL Optimization in the operation column to view the execution example, execution plan, SQL optimization suggestion, and SQL optimization comparison on the pop-up Analysis page. For detailed SQL optimization introduction and usage, see SQL Optimization.
5.2 View and download session statistics
Select the Session Statistics tab, and select the statistics items (including user, access source, database) to collect real-time session data in different dimensions.

5.3 View active sessions
5.3.1 Select the Active Sessions tab, set the following conditions, and view real-time sessions.

Select the number of sessions to display: It includes limiting to 20, 50, or 100, with a default value of 20.
Filter sessions by field: The default COMMAND field is set to Not Sleep. The specific field descriptions are shown in the table below.
Field
Description
ID
Session ID.
USER
The user who initiates the session.
HOST
The IP address and port number of the client that initiates the session.
STATE
The status of the current SQL statement. An SQL statement, such as a query, may need to go through statuses like copying to tmp table, sorting result, and sending data to complete.
DB
The database name of the session current connection.
COMMAND
SQL command type, including ALL, Not Sleep, and others.
ALL
Not Sleep
Others: Including Binlog Dump, Change user, Close stmt, Connect, Connect Out, Create DB, Daemon, Debug, Delayed insert, Drop DB, Error, Execute, Fetch, Field List, Init DB, Kill, Long Data, Ping, Prepare, Processlist, Query, Quit, Refresh, Register Slave, Reset stmt, Set option, Shutdown, Sleep, Statistics, Table Dump, and Time.
INFO
The SQL statement that is executed.
TIME(s)
The session duration. Real-time refresh is based on the selected page refresh frequency.
Select whether to display sleep connections: It is disabled by default.
5.3.2 View the filtered real-time sessions based on the filtering conditions.

The following operations are also supported by hovering over the corresponding INFO column of the session:
View or copy the complete SQL statement: You can click View or Copy.
SQL optimization: You can click SQL Optimization to view the execution example, execution plan, SQL optimization suggestion, and SQL optimization comparison on the pop-up Analysis page. For detailed SQL optimization introduction and usage, see SQL Optimization.
5.3.3 (Optional) You can click

on the upper right side of the list to download the real-time session list in .csv format.
5.4 View performance monitoring data
You can enter the Real-Time Session page, and view real-time performance monitoring data and trends within 2 minutes in the Performance Monitoring area.
Performance monitoring data includes Running Threads (number of running threads), CPU (CPU utilization), Connected Threads (number of connected threads).
Hover over a specific time point to display the detailed data of the three performance metrics.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback