ApsaraDB PolarDB MySQL-compatible edition provides the SQL Explorer feature that integrates the specific features of Database Autonomy Service (DAS). You can enable SQL Explorer to use the search, SQL Explorer, and security audit features of DAS Professional Edition in a convenient manner. This helps you obtain the details about SQL statements, troubleshoot performance issues, and identify the sources of high-risk SQL statements.

Pricing

You are charged for SQL Explorer based on the storage of audit logs.
  • Mainland China: USD 0.0013/GB/hour
  • China (Hong Kong) and regions outside China: USD 0.0019/GB/hour
Note The storage of audit logs is billed based on the pay-as-you-go billing method. The subscription billing method is not supported. For more information, see Pricing of SQL Explorer (optional).

Supported features

  • Enhanced searches

    The search feature allows you to query and export SQL statements and the related information. The information includes databases, states, and execution duration. For more information, see Search.

  • SQL Explorer

    The SQL Explorer feature is used to diagnose the health status of SQL statements, troubleshoot performance issues, and analyze business traffic. For more information, see SQL Explorer.

  • Security audit

    The security audit feature is used to automatically identify risks such as high-risk SQL statements, SQL injections, and new request sources. For more information, see Security audit.

Enable the SQL Explorer feature

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. Click Enable.
    Enable the SQL Explorer feature
    • If you do not have DAS Professional Edition, click Buy to purchase DAS Professional Edition. Then, activate DAS Professional Edition.
    • If you have DAS Professional Edition, click Enable Professional Edition.
    After DAS Professional Edition is activated, you can use the search, SQL Explorer, and security audit features of DAS Professional Edition. SQL Explorer

Change the retention period of SQL logs

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. In the upper-right corner of the SQL Explorer page, click Service Settings.
  6. Change the retention period and click Ok.

Export SQL log entries

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. On the right side of Logs, click Export.
    1
  6. In the Export SQL Records dialog box, select the required fields, specify the time range, and then click Ok.
    Export SQL log entries
  7. After log entries are exported, you can click Download in the Export SQL Log Entries panel to export SQL log entries to a .csv file.
    Download SQL logs
  8. Click OK.

Disable the SQL Explorer feature

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. Click Service Settings.
  6. In the dialog box that appears, turn off the Enable switch and click Ok.
    Disable the SQL Explorer feature
    Note After you disable the SQL Explorer feature, all SQL log entries are deleted. We recommend that you export SQL log entries before you disable this feature. For more information about how to export SQL log entries, see Export SQL log entries.

View the size and consumption details of audit logs

  1. Log onto the Alibaba Cloud Management Console.
  2. In the upper-right corner of the page, choose Expenses > User Center.
  3. In the left-side navigation pane, choose Spending Summary > Spending Summary.
  4. Click the Details tab. In the search bar, select Instance ID from the drop-down list and enter the ID of the cluster for which you want to query the details.
    Note To query logs generated more than 12 months ago, Submit a ticket.
    Bills
  5. View the billing details in the data entries in which the value in the Billing Item column is sql_explorer.