All Products
Search
Document Center

PolarDB:Slow SQL

Last Updated:Mar 28, 2026

The slow SQL analysis feature in PolarDB for PostgreSQL (Compatible with Oracle) helps you identify and resolve query performance issues without leaving the console. Use it to visualize slow query trends, examine event distributions, drill into individual SQL statements, and take corrective action through diagnostic optimization or SQL throttling.

Slow SQL analysis views

The Slow Log Analysis tab provides four views. Each view serves a distinct purpose:

ViewDescription
Slow Query Log TrendsA time-series chart showing how slow query frequency changes over the selected time range. Use it to spot performance spikes and correlate them with deployment or traffic events.
Event DistributionA breakdown of slow query log events within the selected time range. Click an event to see its details.
Slow Query Log StatisticsSlow queries grouped by SQL template. Use this view to identify recurring patterns and templates responsible for the most performance overhead.
Slow Query Log DetailsIndividual SQL statements with options to run diagnostic optimization or apply throttling.

Analyze slow queries in the console

  1. Log on to the PolarDB console. In the left-side navigation pane, click Clusters. In the upper-left corner, select the region of the cluster. In the cluster list, find the cluster and click its ID to go to the Basic Information page.

  2. In the left-side navigation pane, choose Diagnostics and Optimization > Slow SQL.

  3. On the Slow Log Analysis tab, set a time range to filter data.

    The end time must be later than the start time, and the interval cannot exceed 24 hours. You can query slow query logs from the previous month.

  4. Use the four views to investigate slow queries:

    • Slow Query Log Trends

    • Event Distribution

      This section lists slow query log events within the selected time range. Click an event to see its details.

    • Slow Query Log Statistics

      This tab groups slow queries by SQL template. To inspect log samples for a template, find the template and click Details in the Actions column. The Slow Log Sample dialog box shows representative log entries for that template.

    • Slow Query Log Details

      This tab lists individual SQL statements. To take action on a statement, find it and click one of the following in the Actions column:

      ActionWhat it does
      OptimizeRuns SQL diagnostic analysis on the statement and returns suggestions for improving performance.
      ThrottlingApplies SQL throttling to limit the rate at which the statement executes.

FAQ

Why does the execution completion time in slow query logs differ from the actual time?

This happens when an executed SQL statement modifies the time zone recorded in the slow query log. Completion time is determined by the time zone resolved in the following order: session level, then database level, then system level. If the database has a configured time zone, that time zone is used. Otherwise, the system time zone applies. When a statement changes the time zone at the session level, the recorded time may not convert correctly, causing the discrepancy.

API reference

OperationDescription
DescribeSlowLogRecordsQueries the details of slow logs for a cluster.
DescribeDBClusterAuditLogCollectorQueries whether SQL data collector is enabled for a cluster.
ModifyDBClusterAuditLogCollectorEnables or disables SQL data collector for a cluster.

References