This topic describes how to use the SQL Explorer and Audit feature on an ApsaraDB RDS for PostgreSQL instance. The SQL Explorer and Audit feature is based on the full request analysis and security audit capabilities of Database Autonomy Service (DAS) and is integrated with the SQL statement search feature and the SQL Explorer feature. You can query information about executed SQL statements. Then, you can use the information to troubleshoot various performance issues.
Prerequisites
- DAS Professional Edition is purchased within your Alibaba Cloud account. For more information about how to purchase DAS Professional Edition, see Purchase DAS Professional Edition.
- The RDS instance runs RDS High-availability Edition.
- The RDS instance resides in one of the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), China (Zhangjiakou), Singapore, Malaysia (Kuala Lumpur), and Indonesia (Jakarta).
- If you use the credentials of a RAM user to use the Search feature, make sure that the AliyunRDSReadOnlyWithSQLLogArchiveAccess policy is attached to the RAM user. For more information about how to grant permissions to a RAM user, see Use RAM to manage ApsaraDB RDS permissions. Note You can also create a custom policy to grant the RAM user the permissions to use the Search feature, including the log export feature. For more information, see What do I do if I do not have permissions to access DAS as a RAM user?
Billing
You are charged for DAS Professional Edition. For more information, see Billing overview.
Note After the SQL Explorer and Audit feature is enabled, ApsaraDB RDS stops billing the Use the SQL Audit feature on an ApsaraDB RDS for PostgreSQL instance feature. The pricing of the SQL Explorer and Audit feature is based on the pricing of DAS Professional Edition.
Overview
- The SQL statement search feature is used to query and export the SQL statements that are executed and the information about the SQL statements. The information includes the database, status, and execution duration of each SQL statement. For more information, see Search.
- The SQL Explorer feature is used to perform health diagnoses on SQL statements, troubleshoot performance issues, and analyze business traffic. For more information, see SQL Explorer.
Enable the SQL Explorer and Audit feature
- Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
- In the left-side navigation pane, choose .
- If the SQL Explorer and Audit feature is not enabled, click Enable on the page that appears. In the dialog box that appears, click Enable Professional Edition. Note If the page that appears contains the Search and SQL Explorer tabs, the SQL Explorer and Audit feature is enabled.
Query information on the Search tab
- Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
- In the left-side navigation pane, choose .
- On the page that appears, click the Search tab. Then, specify the search conditions based on which you want to query the relevant information. For more information about the Search tab, see Search. To export logs, click Export and specify Exported Fields in the Export SQL Records dialog box. You can configure Export Time Range to export logs that are generated both within and beyond a time range of 24 hours.
Query information on the SQL Explorer tab
- Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
- In the left-side navigation pane, choose .
- On the page that appears, click the SQL Explorer tab. Then, view the relevant information of the RDS instance. For more information about the SQL Explorer tab, see SQL Explorer.