SQL Explorer captures all Data Query Language (DQL), Data Manipulation Language (DML), and Data Definition Language (DDL) operations and outputs the data through the database kernel with minimal CPU usage. Use it to understand query performance, compare load across time periods, and decide whether to scale or optimize.
Prerequisites
Before you begin, ensure that you have:
Diagnose SQL performance
A typical performance investigation follows this sequence:
Check the Execution Duration Distribution chart to see whether query latency is trending toward orange or red.
If it is, expand Full Request Statistics to identify which SQL types consume the most resources.
Drill into a specific SQL type using its SQL ID to track performance trends over time.
If load comes from a specific client or user, use Source Statistics or User Statistics to narrow it down.
To verify whether a configuration change improved performance, use Display by Comparison to compare two time periods.
On the SQL Explorer tab, select one of the following views based on your goal.
View execution duration distribution
Select Display by Time Range to see how SQL execution durations are distributed within a selected time range. The dashboard shows three charts:
Execution Duration Distribution — a color-coded breakdown of query latency across seven intervals, updated every minute
Execution Duration — the actual duration of SQL queries over time
Executions — the number of SQL executions over time
To see all SQL statements in the selected period, click Hide/Show More to expand the Full Request Statistics section. Click Export to download the data (up to 10 million rows per export).
Reading the Execution Duration Distribution chart:
| Color | Meaning | What to do |
|---|---|---|
| Blue | Optimal performance — most queries complete quickly | No action needed |
| Orange / Red | SQL health declining — queries are taking longer | Identify the high-resource SQL types in Full Request Statistics and optimize queries or consider scaling |
The seven duration intervals are:
| Interval | Range |
|---|---|
[0,1]ms | 0 ms – 1 ms |
[1,2]ms | 1 ms – 2 ms |
(2,3]ms | 2 ms – 3 ms |
(3,10]ms | 3 ms – 10 ms |
(10,100]ms | 10 ms – 100 ms |
(0.1,1]s | 0.1 s – 1 s |
>1s | Longer than 1 s |
Compare SQL performance across two time ranges
Select Display by Comparison to select two separate time ranges. The Requests by Comparison section shows how Execution Duration Distribution, Execution Duration, and Executions differ between the two periods. Use this view to confirm whether a configuration change or deployment improved query performance.
Identify load by source IP
Select Source Statistics to break down SQL execution by source IP address. This helps you pinpoint which client or application is generating the most load.
Source Statistics is supported only for compute nodes.
Identify load by database account
Select User Statistics to view SQL execution grouped by database account. Use this view to attribute load to specific users or services.
User Statistics is supported only for compute nodes.
Run traffic playback and stress testing
Select Traffic Playback and Stress Test to replay captured traffic against the instance. This lets you verify performance under real business load and determine whether you need to scale instance specifications before going live, and reduces the risk of failures after the system goes online. For details, see Traffic playback and stress testing.
Understand Full Request Statistics fields
The Full Request Statistics section lists aggregated SQL data for each SQL type in the selected time range.
| Field | Description |
|---|---|
| SQL ID | Unique identifier for a SQL type. Use the SQL ID to track its performance trends and sample data. |
| SQL statement | The SQL statement template representing this SQL type. |
| Execution duration percentage | The share of total MySQL resource consumption attributed to this SQL type. A higher percentage means higher resource usage. |
| Average execution duration | Average execution time for this SQL type within the selected range. |
| Execution trend | Visual trend of execution over time. |
| SQL Sample | The source IP address of the application client that initiated the query. Encoded in UTF-8. |
Execution duration percentage formula:
Execution duration percentage =
(Execution duration of the SQL type × Number of executions)
─────────────────────────────────────────────────────────── × 100%
(Total execution duration of all SQLs × Total executions)The higher the execution duration percentage, the more MySQL resources this SQL type consumes relative to all other queries.
What's next
Traffic playback and stress testing — replay production traffic to validate scaling decisions
SQL insight and stress testing (new version) — the prerequisite feature that powers SQL Explorer