AnalyticDB for PostgreSQL provides the SQL audit feature for you to view SQL details and audit SQL activities on a regular basis. Enabling SQL audit does not affect instance performance.

Background information

SQL audit records all DML and DDL operations. The system captures such operations by analyzing data transmitted through network protocols. A few records may be lost when a large number of SQL queries are sent to database instances.

Precautions

  • SQL audit records are saved for 30 days.
  • By default, SQL audit is disabled for instances. When this feature is enabled for instances, additional fees will be incurred. For more information, see AnalyticDB for PostgreSQL pricing.

Procedure

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. Select the region where an instance is located from the Region drop-down list.
  3. Click Manage in the Actions column corresponding to the instance.
  4. In the left-side navigation pane, click Security.
  5. Click the SQL Audit tab, and click Enable.
  6. In the message that appears, click OK to enable SQL audit.
    • After enabling SQL audit, you can query SQL information based on conditions such as Select Time Range, DB, User, and Keyword.
    • To disable SQL audit, click Disable SQL Audit on the SQL Audit tab.

Related API operations

API operation Description
ModifySQLCollectorPolicy You can call this operation to enable or disable the SQL collection feature for a specified instance.