All Products
Search
Document Center

ApsaraDB for SelectDB:Use the query audit feature

Last Updated:Jul 17, 2026

Query audit records every SQL statement executed in your SelectDB instance, providing a complete history of read, write, and delete operations. You can use it to investigate security incidents, track data changes, and identify slow queries.

By default, query audit is enabled. The Query Audit page shows audit logs from the previous 8 hours.

Prerequisites

Before you begin, ensure that you have:

  • A SelectDB instance running version 3.0.7 or later. To create one, see Create an instance

Access query audit

  1. Log on to the SelectDB console.

  2. In the top navigation bar, select the region where your instance resides.

  3. In the left-side navigation pane, click Instances. On the Instances page, click the instance ID to go to the Instance Details page.

  4. In the upper-right corner, click Data Development and Management.

    If this is your first time using Data Development and Management, a prompt appears asking you to add your machine's public IP address to the webui_whitelist IP address whitelist. Click OK.
  5. From the drop-down list, select Query Audit.

    If you have not logged on to the WebUI system before, the WebUI logon page appears. Log on using the admin account. To reset the admin password, see Reset the password of an account.

Enable or disable query audit

  1. On the Query Audit page, click the Query Audit Configuration icon in the upper-right corner.

  2. In the Query Audit Configuration dialog box, turn Query Audit on or off, then click Confirm.

Important

Enabling query audit logs all SQL statements to the audit log table, which consumes storage space. Disabling query audit immediately stops new entries from being written; existing audit logs remain unchanged.

View and filter audit logs

The Query Audit page displays audit log entries.

You can filter logs by using the following parameters at the top of the page:

Parameter Description
Logs Filter by log type
Status Filter by query status
Time range Limit results to a specific period

To apply filters:

  1. Set the Logs and Status parameters, and select a time range.

  2. Click the Filter icon, enable the filter conditions you want to use, then click Confirm.

Download audit logs

On the Query Audit page, click the Download icon to download the queried audit logs.

View a query profile

A query profile displays the execution plan for a specific query, helping you analyze where time is spent.

Important

Before viewing a query profile, note the following:

  • The logon account must be admin.

  • SelectDB Core 4.0 or later: view profiles online and download them.

  • SelectDB Core 3.0: download only (online viewing is not available).

To view a query profile:

  1. On the Query Audit page, find the query and click its ID in the Query ID column.

  2. On the query details page, click Query Profile in the upper-left corner.

Query Profile is enabled by default for all queries run on the SQL Editor page. This may slightly affect the performance of individual queries.

Related resources

API reference

See also