AnalyticDB for PostgreSQL provides the SQL audit feature to collect statistics on all DML and DDL operations. You can use the SQL audit feature to view details about SQL statements and audit SQL statements on a regular basis. The SQL audit feature does not affect instance performance.

Precautions

  • SQL audit logs can be retained for 30 days.
  • SQL audit records are obtained from network protocol analysis, and a small number of records may be lost if a large amount of data is queried.

Procedure

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select the region where the instance resides.
  3. Find the instance that you want to manage and click the instance ID.
  4. In the left-side navigation pane, click SQL Audit.
  5. On the SQL Audit tab, search SQL information by Database Name, Execution Duration, Select Time Range, Database User, Source IP, Execution Status, Operation Category, Operation Type, and Text.
    Note You can copy and export SQL information from SQL details on the current page.

Related operations

Operation Description
DescribeSQLLogs Queries SQL logs within a specific time range.
DescribeSQLLogCount Queries the number of audit logs.