Updated on 2025-01-02 GMT+08:00

Creating a SQL Insights Task

Scenarios

SQL Insights allows you to not only query all executed SQL statements, but also analyze and search for the tables that are accessed and updated most frequently, and the SQL statements that have the longest lock wait, helping you quickly identify exceptions.

Constraints

  • You need to enable Collect All SQL Statements before using SQL Insights.
  • After Collect All SQL Statements is disabled, new SQL statements will not be collected anymore and the collected SQL data will be deleted.
  • Only the tasks created in the last two days can be displayed.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the DB instance name.
  5. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  6. Click SQL Explorer and then SQL Insights.
  7. Click next to Collect All SQL Statements.

    To disable this function, click Log Settings in the upper right corner, toggle off the Collect All SQL Statements switch, and click OK.

    Collecting all SQL statements generates a performance loss of no more than 5%.

    Figure 1 Log settings

  8. Click Create Task. In the displayed dialog box, specify Time Range, Dimension, and other configuration items, and click OK.

    Figure 2 Creating a SQL Insights Task

  9. In the task list, click Details in the Operation column to view task details.

    Figure 3 Viewing task details