The SQL Explorer feature provides value-added services for your databases, such as security audit and performance diagnostics.

Billing rules

  • The trial edition is free of charge. Audit logs are retained for only one day. You can query only the data within the last day. In the trial edition, advanced features, such as data exporting, are not supported, and data integrity is also not ensured.
  • 30 days or more: You are charged for the storage that is consumed by audit logs.
    • Mainland China: USD 0.0013/GB/hour.
    • China (Hong Kong) and regions outside China: USD 0.0019/GB/hour.
    Note The storage that is consumed by audit logs is charged only on a pay-as-you-go basis. For more information, see Billing rules of SQL Explorer (optional).

Features

  • SQL audit logs

    All operations that are performed on databases are recorded in audit logs. You can use audit logs to analyze database failures and behaviors, and perform security audit.

  • Enhanced search
    This feature allows you to search data by using multiple conditions, such as the database, user, client IP, thread ID, execution duration, and execution status. It also allows you to export and download the results.Search
  • SQL analysis
    This feature provides a visualized and interactive solution to analyze logs of a specified time period for SQL statements in the console. This allows you to find the SQL statements that are not executed as normal and locate performance issues.AnalysisNumber of executions

Enable SQL Explorer

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. Click Enable.
    Enable
  6. Select the retention period of SQL audit logs, and then click Activate.
    Activate the service

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 resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the left-side navigation pane, choose Log and Audit > SQL Explorer.
  5. Click Service Settings in the upper-right corner of the page.
  6. Change the retention period and click OK.

Export SQL logs

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

Disable SQL Explorer

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then 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 Enable and click OK.
    Disable
    Note After you disable the SQL Explorer feature, audit logs are deleted. Before you disable the feature, we recommend that you export SQL logs. For more information about how to export SQL logs, see Export SQL logs.
  7. In the message that appears, click OK.

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, select Instance ID and enter the ID of the cluster for which you want to query the details.
    Note To query the records generated more than 12 months ago, Submit a ticket.
    Bills
  5. You can view the billing details whose Billing Item is sql_explorer.