All Products
Search
Document Center

PolarDB:SQL Explorer

Last Updated:Mar 28, 2026

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:

  1. Check the Execution Duration Distribution chart to see whether query latency is trending toward orange or red.

  2. If it is, expand Full Request Statistics to identify which SQL types consume the most resources.

  3. Drill into a specific SQL type using its SQL ID to track performance trends over time.

  4. If load comes from a specific client or user, use Source Statistics or User Statistics to narrow it down.

  5. 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:

ColorMeaningWhat to do
BlueOptimal performance — most queries complete quicklyNo action needed
Orange / RedSQL health declining — queries are taking longerIdentify the high-resource SQL types in Full Request Statistics and optimize queries or consider scaling

The seven duration intervals are:

IntervalRange
[0,1]ms0 ms – 1 ms
[1,2]ms1 ms – 2 ms
(2,3]ms2 ms – 3 ms
(3,10]ms3 ms – 10 ms
(10,100]ms10 ms – 100 ms
(0.1,1]s0.1 s – 1 s
>1sLonger 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.

FieldDescription
SQL IDUnique identifier for a SQL type. Use the SQL ID to track its performance trends and sample data.
SQL statementThe SQL statement template representing this SQL type.
Execution duration percentageThe share of total MySQL resource consumption attributed to this SQL type. A higher percentage means higher resource usage.
Average execution durationAverage execution time for this SQL type within the selected range.
Execution trendVisual trend of execution over time.
SQL SampleThe 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