All Products
Search
Document Center

ApsaraDB for SelectDB:Query audit

Last Updated:Aug 26, 2026

Query audit monitors, records, and analyzes SQL queries executed in a database, helping database administrators (DBAs) track user operations such as data retrieval, updates, and deletions, and perform slow query analysis to ensure database security and stability.

Prerequisites

  • An ApsaraDB for SelectDB instance is created. For more information, see Create an instance.

  • The instance version is 3.0.7 or later.

Procedure

  1. Log on to the ApsaraDB for SelectDB console.

  2. In the upper-left corner of the page, select the region where your instance is located.

  3. On the Instances page, click the target Instance ID to go to the Instance Details page.

  4. In the left-side navigation pane, choose Data Development and Management (Studio) > Query Audit.

    Note
    • When you use Data Development and Management for the first time, you are prompted to add your local public IP address to the webui_whitelist IP address whitelist group. Read the prompt carefully and click OK.

    • When you use Query Audit for the first time, if you are not logged in to the WebUI system, you are redirected to the WebUI logon page.

      • You can use the admin account to log on to the WebUI system.

      • If you have forgotten the password for the admin account, you can reset it. For more information, see Reset the password of an account.

    • By default, the Query Audit page displays all query logs from the last 8 hours.

  5. On the Query Audit page, you can perform the following operations.

    • Enable query audit: Click the configuration icon in the upper-right corner. In the Query Audit Configuration dialog box, turn on the Query Audit Configuration switch and click OK.

      Important

      After enabling query audit, the system stores your queries in an audit log table, which consumes storage space.

    • Disable query audit: Click the configuration icon in the upper-right corner. In the Query Audit Configuration dialog box, turn off the Query Audit Configuration switch and click OK.

      Important

      Disabling query audit immediately stops writing to the audit log table. Existing audit logs are not affected.

    • View audit logs: In the upper-left area of the page, select values from the Log and Status drop-down lists and set a time range. To apply more filters, click the filter icon, enable the switches for the desired filter types, and click OK.

    • Download audit logs: Click the download icon in the upper-right area of the page to download the displayed audit logs.

    • View profile information: Click an ID in the Query ID column to open the query details page. On this page, click Query Profile in the upper-left corner to view the execution plan. You can perform the following operations:

      Important

      Note the following when you use this feature:

      • You must be logged in with the admin account.

      • Instances running version 4.0 or later support viewing profiles online and downloading them. Instances running version 3.0 only support downloading profiles.

      • View profile information online to analyze SQL statement execution.

      • Download the profile file.

        Note

        By default, queries initiated from the SQL Editor page have query profiling enabled, which may have a minor impact on the performance of individual queries.

API reference

ResetAccountPassword

DescribeSecurityIPList

ModifySecurityIPList

Related documents

Create an instance

Reset the password of an account

Configure an IP address whitelist