Updated on 2023-03-07 GMT+08:00

SQL Explorer

Precautions

After SQL Explorer is disabled, DAS will stop collecting new SQL statements and delete collected SQL data.

Procedure

  1. Log in to the DAS console.
  2. On the Overview page, click Go to Intelligent O&M.
  3. Select the required instance and click Details.
  4. Choose SQL > SQL Explorer to view SQL Explorer details of the instance.
  5. Toggle on Enable DAS SQL Explorer to obtain information about all SQL statements executed on the current instance.

    • SQL Explorer takes effect once it is enabled.

  6. Click the TOP SQL tab, select Last 1 hour, Last 3 hours, or Last 6 hours or specify a time range spanning no more than one day, to view the top SQL statements executed.

    Figure 1 TOP SQL

    Execution Duration Distribution displays the distribution of execution durations for all SQL templates in a specific period of time. There are four execution duration ranges. The system calculates how many times the SQL templates are executed in each execution duration range. If you select Last 1 hour, the execution durations are calculated every 10 seconds. If you select Last 6 hours, the execution durations are calculated every 1 minute. If you select a time range longer than 6 hours, the execution durations are calculated every 5 minutes. The execution duration ranges of SQL templates are as follows:

    • < 100 ms
    • 100 ms—500 ms
    • 500 ms—1s
    • > 1s

  7. Use either of the following method to view execution duration details, such as average execution duration, total duration, average lock wait duration, and average scanned rows.

    • Hover your mouse at any point in time on the graph to view top SQL templates at that time.
    • Specify a time range using your mouse on the graph, and you will see top SQL templates used during that time range.

  8. In the SQL template list, locate a SQL template and click Details to view the total execution times, average rows scanned, average execution duration, and the like.
  9. On the SQL Audit page, specify data collection time, task creation time, and node information to search for SQL audit tasks.
  10. Click Add SQL Audit Task and specify a time range to add a task. You can add instance- or node-level task based on your service requirements.
  11. Locate the added task in the lower part.
  12. Click View Detail in the Operation column to view task details.
  13. Specify conditions such as Time Range, User, Keyword, Database and click Query. The selected time range must be after the time when the SQL audit task is added.