All Products
Search
Document Center

ApsaraDB for OceanBase:Session management

Last Updated:Oct 22, 2024

The connection between an application and a database is called a session. With the session management feature, you can view tenant sessions, session statistics, and deadlock detection.

View tenant sessions

On the Tenant Session tab:

  • Select View Only Active Sessions to search for active sessions.

  • Filter sessions by User and Database Name.

  • Search for sessions by Session IDSQLSource, and Target End.

  • Sort sessions by Execution Time.

  • Click an SQL statement go to the SQL Execution Details page.

    • For SQL statements that meet one of the following conditions, the SQL Execution Details page will display the operator execution plan and operator execution details, as shown in the figure below.

      • SQL that uses the MONITOR Hint

      • SQL that uses hints related to parallel execution

      • Slow SQL (execution time exceeds 5 seconds)image

        Note
    • For other SQL statements, the SQL Execution Details page only displays the operator execution plan.

  • Close the target sessions.

    • To close a single session: Click Close Session in the Operation column of the target session.

    • To close multiple sessions: Select the check boxes before the target sessions, and then click Close Sessions in Batches on the right.

    • To close all sessions:

      • Select the check box to the left of Session ID, and then click Close Sessions in Batches on the right.

      • Select any session, click Select All above, and then click Close Sessions in Batches on the right.

  • In the pop-up confirmation box, click OK.

View session statistics

On the Session Statistics tab:

  • View or export the number of active sessions and the total number of sessions of the current cluster by user, access source, or database.

  • Click 10-second SQL Analysis in the upper-right corner to analyze the executions of SQL statements in the tenant within 10 seconds. You can view the analysis results by SQL Type, User, Source, and Database. image.png

View deadlock detection

On the Deadlock Detection tab:

  • If you use deadlock detection for the first time, click Turn on Deadlock Detection. After deadlock detection is enabled, ApsaraDB for OceanBase detects and handles deadlock events in real time, which consumes about 2% of the system resources. Choose whether to enable deadlock detection based on your cluster conditions.

    Note

    Deadlock detection is only supported by ApsaraDB for OceanBase V4.x.

    1

  • After deadlock detection is enabled, the system will detect whether there are deadlocks in the tenants of the cluster and provide detection results in the Deadlock Details section. The results will be retained for 7 days.3

  • Click Turn off Deadlock Detection in the upper-right corner to disable deadlock detection or click Refresh to refresh deadlock detection details.