All Products
Search
Document Center

Database Autonomy Service:Session management

Last Updated:Feb 27, 2026

Database Autonomy Service (DAS) session management lets you monitor active and abnormal database sessions in real time and take action to resolve performance issues. You can view session metrics, run 10-second SQL analysis, apply SQL throttling, optimize SQL statements, and terminate sessions.

The examples in this document use an ApsaraDB RDS for MySQL instance.

Prerequisites

  • The database instance is connected to DAS and is in the Normal Access state

  • The database instance is not an ApsaraDB RDS for SQL Server instance. DAS does not provide session management for ApsaraDB RDS for SQL Server instances.

Warning

For RDS MySQL 8.0 instances with minor engine versions earlier than 20230610, concurrent execution of commands such as COM_STATISTICS, COM_CHANGE_USER and the SHOW PROCESSLIST statement may cause deadlocks, resulting in instance connection failures. Update to the latest minor engine version to avoid this issue.

Open session management

  1. Log on to the DAS console.

  2. In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.

  3. Find the target database instance and click its instance ID.

  4. In the left-side pane, click Instance Sessions.

The Session Management tab displays two sections: Instance Sessions and Session Statistics.

Instance sessions

The Instance Sessions section shows session details and provides diagnostic actions.

Real-time metrics

The section header displays the following metrics:

MetricDescription
Exceptional sessionsNumber of sessions flagged as abnormal
Active sessionsNumber of currently active sessions
Longest execution durationDuration of the longest-running query
CPU utilizationCurrent CPU usage of the instance
Connection usageCurrent connection count relative to the limit

Run 10-second SQL analysis

Click 10s SQL Analysis in the upper-right corner of the section. The dialog box displays query activity captured over a 10-second window, including:

  • Summary information

  • Slow query logs

  • SQL overview

For more information, see 10-second SQL analysis.

Enable SQL throttling

Click SQL Throttling to open the SQL Throttling dialog box. Configure the parameters to apply threshold-based SQL throttling on sessions.

For more information, see SQL throttling.

Optimize SQL

Click Optimize in the session list to optimize a SQL statement.

For more information, see SQL optimization.

Export active sessions

Export active sessions from the Instance Sessions section.

Terminate sessions

To terminate a session, enter the account and password of the database in which the session was created. You can also use an account that has the permissions to terminate sessions created by other accounts, such as a privileged account.

  • The User column shows the database account that created each session.

  • Click End Session History to view records of terminated sessions.

Session statistics

The Session Statistics section displays summary information and session statistics grouped by user, access source, or database.

Summary information includes:

MetricDescription
Total number of sessionsAll sessions on the instance
Total number of ongoing sessionsSessions currently in progress
Longest session durationDuration of the longest session

Export summary information and session statistics by user, access source, or database.

FAQ

Why does a percent sign (%) appear in the Access Source column?

A percent sign (%) may appear in the Access Source column on the Source Statistics tab of the SQL Explorer tab when a stored procedure is used.

The following steps reproduce this behavior. In this example, the database instance is an ApsaraDB RDS for MySQL instance, the test account is test_user, and the test database is testdb.

  1. Create a database and a standard account, and grant permissions on the database to the standard account in the ApsaraDB RDS console. For details, see Create accounts and databases.

  2. Connect to the instance as test_user by using the CLI. For details, see Use a database client or the CLI to connect to an ApsaraDB RDS for MySQL instance.

  3. Switch to the testdb database and create a stored procedure:

    -- Switch to the testdb database.
    USE testdb;
    
    -- Create a stored procedure.
    DELIMITER $$
    DROP PROCEDURE IF EXISTS `das` $$
    CREATE DEFINER=`test_user`@`%` PROCEDURE `das`()
    BEGIN
    SELECT * FROM information_schema.processlist WHERE Id = CONNECTION_ID();
    END $$
    DELIMITER;
  4. Connect to the database instance with a privileged account. For details, see Use a database client or the CLI to connect to an ApsaraDB RDS for MySQL instance.

  5. Call the stored procedure:

    -- Switch to the testdb database.
    USE testdb;
    
    -- Call the stored procedure.
    CALL das();
    
    +--------+-----------+--------+--------+---------+------+-----------+-------------------------------------------------------------------------+
    | ID     | USER      | HOST   | DB     | COMMAND | TIME | STATE     | INFO                                                                    |
    +--------+-----------+--------+--------+---------+------+-----------+-------------------------------------------------------------------------+
    | 487818 | test_user | %:2065 | testdb | Query   |    0 | executing | SELECT * FROM information_schema.processlist WHERE Id = CONNECTION_ID() |
    +--------+-----------+--------+--------+---------+------+-----------+-------------------------------------------------------------------------+

The HOST column shows %:2065, which causes the percent sign to appear in the Access Source column.

What sessions are marked as abnormal for ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters?

The following sessions are marked as abnormal:

ConditionDetails
Blocking SQL with execution duration exceeding 30 secondsBlocking SQL statements occupy resources for an extended period, preventing other SQL statements from running. Common examples include the FLUSH TABLES WITH READ LOCK statement and DDL statements waiting for metadata locks due to pending transactions (for example, a session reporting a "Waiting for table metadata lock" error).
Transactions with duration exceeding 30 secondsLong-running transactions that hold resources beyond the 30-second threshold.
Uncommitted transactions with no new SQL executed for more than 10 secondsIf a transaction is started in a session but no new SQL statements are executed for more than 10 seconds, the COMMIT command is likely omitted from the code. This causes the transaction to hold resources and delay their release.