All Products
Search
Document Center

AnalyticDB:Enable SQL audit

Last Updated:Mar 28, 2026

SQL audit tracks all Data Manipulation Language (DML) and Data Definition Language (DDL) operations on your AnalyticDB for PostgreSQL instance. Use it to inspect SQL statement details and run periodic audits for security compliance and troubleshooting — without affecting instance performance.

Usage notes

  • Audit logs are retained for 14 days. This period cannot be changed.

  • Records are collected through network protocol analysis. A small number of records may be lost when processing large query volumes.

View SQL audit records

Prerequisites

Before you begin, ensure that you have:

Search audit records

  1. Log on to the AnalyticDB for PostgreSQL console.

  2. In the upper-left corner, select the region where the instance resides.

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

  4. In the left-side navigation pane, click Instance Audit.

  5. Use the following filters to narrow down the audit records:

    FilterDescription
    Database NameFilter by the name of the database where the SQL was executed
    Execution DurationFilter by how long the SQL statement took to run
    Select Time RangeFilter by the time window when the SQL was executed
    Database UserFilter by the database user who ran the statement
    Source IPFilter by the IP address of the client that sent the request
    Execution StatusFilter by whether the statement succeeded or failed
    Operation CategoryFilter by the category of the operation
    Operation TypeFilter by the specific type of database operation
    TextSearch by keywords within the SQL statement text
Note

To save audit records, open the SQL details on the current page and use the copy or export options.

API reference

OperationDescription
DescribeSQLLogCountQueries the number of audit logs.