Database Autonomy Service (DAS) provides SQL Explorer. You can use SQL Explorer to diagnose the health status of SQL statements and troubleshoot performance issues. This topic describes how to use SQL Explorer in the SQL Insight and audit module.

Prerequisites

  • The database instance that you want to manage is connected to DAS and is in the Accessed state.
  • DAS Professional Edition is activated for the source instance and the destination instance. For more information, see DAS Professional Edition.
  • The full request analysis feature is enabled for the database instance. For information about how to enable the full request analysis feature, see Full request analysis.
  • DAS provides SQL Explorer only for the following types of database instances:
    • ApsaraDB RDS for MySQL High-availability Edition and Enterprise Edition
    • ApsaraDB RDS for PostgreSQL High-availability Edition
    • Single Node Edition, Archive Database Edition, and Cluster Edition of the ApsaraDB PolarDB MySQL-compatible edition
    • Cluster Edition of the ApsaraDB PolarDB PostgreSQL-compatible edition

Background information

The SQL Explorer feature records the information about all the executed Data Query Language (DQL), DML and DDL statements. The system captures the information by analyzing data transmitted over network protocols. This consumes only a small amount of CPU resources. The Trial Edition of SQL Explorer allows you to store SQL log files for up to one day free of charge. If you want to store SQL log files for more than one day, you must pay extra fees.

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring. On the Instance Monitoring page, click the ID of the instance that you want to manage.
  3. In the left-side navigation pane of the page that appears, click SQL Insight and audit. On the page that appears, click the SQL Explorer tab.
    0
  4. In the Full Request Analysis - Professional Edition section, you can view the trend charts. In the Full Request Statistics section, you can view and export the full request statistics.
    Note You can export up to 10 million rows of data at a time. For more information, see Full request analysis.

Description

  • Execution Duration Distribution: On the Execution Duration Distribution tab, you can view the distribution of execution durations of SQL queries based on the time range that you specify. The statistical data is collected every minute. The execution durations are divided into seven ranges:
    • [0,1] ms: indicates that the execution duration ranges from 0 ms to 1 ms. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    • (1,2] ms: indicates that the execution duration is greater than 1 ms and less than or equal to 2 ms. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    • (2,3] ms: indicates that the execution duration is greater than 2 ms and less than or equal to 3 ms. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    • (3,10] ms: indicates that the execution duration is greater than 3 ms and less than or equal to 10 ms. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    • (10,100] ms: indicates that the execution duration is greater than 10 ms and less than or equal to 100 ms. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    • (0.1,1]s: indicates that the execution duration is greater than 0.1s and less than or equal to 1s. From the chart, you can view the percentage of SQL queries whose execution duration falls within this range.
    • > 1s: indicates that the execution duration is greater than 1s. From the chart, you can view the percentage of SQL queries whose execution durations fall within this range.
    Note In the Execution Duration Distribution chart, the more the areas are closer to blue, the healthier the instance is when the instance runs SQL queries. The more the areas are closer to orange and red, the less healthy the instance is when it runs SQL queries.
  • Execution Duration: On the Execution Duration tab, you can specify a time range to view the execution durations of SQL queries.
  • Full Request Statistics: In the Full Request Statistics section, you can view the SQL statement details based on the time range that you specify. The details include the SQL text, duration percentage, average execution duration, and execution trend for each SQL statement.
    Note You can calculate the execution duration percentage for the SQL statements that use a specific SQL template based on the following formula: Execution duration percentage = (Execution duration of the SQL statements that use the SQL template × Number of executions of the SQL statements)/(Total execution duration of all SQL statements × Total number of executions) × 100%. Higher execution duration percentages indicate that the instance uses a larger number of MySQL resources to execute the corresponding SQL statements.
  • SQL ID: You can click an SQL ID to view the performance trend and sample data of the SQL statements that use the corresponding SQL template.
  • SQL Sample: On the SQL Sample tab, you can view the client that initiated each sample SQL request.
    Note The UTF-8 character set is used to encode SQL samples.