Skip to main content
The same SQL is executed thousands of times in a slow query log, and listing each execution has no governance value. PawSQL aggregates and deduplicates collected SQL by structure, merging identical-structure SQL into a single row described by execution count, average latency, and max latency. The Slow queries page summary, charts, and table are all based on the aggregated result.
Aggregated slow queries

Slow queries page: summary, 7-day slow SQL, SQL type, optimization status, and average latency

Goal

Represent each distinct SQL structure once in the governance backlog by aggregating and deduplicating collected slow SQL.

Prerequisites

Slow SQL must already be collected into the platform; aggregation runs on the collection result.

Steps

After collection, PawSQL aggregates the slow SQL automatically. Review the backlog with the “Show business SQL only” toggle, the summary metrics, the distribution charts, the table, and the filters.

Show business SQL only

The “Show business SQL only” toggle in the top-right of the summary filters out internal/system SQL. It is on by default. Turn it off to show all slow SQL. Real sample: one instance collected 27 slow SQL, of which 23 were business SQL — the remaining 4 were internal/system SQL (queries on pawsql_internal.*, pawsql_foreign.*, and similar tables).

Summary metrics

Distribution charts

The Slow queries page summarizes the aggregated backlog with four charts:
  • 7-day slow SQL: the daily count trend of slow SQL;
  • SQL type: the count distribution by SQL type (e.g. query);
  • Optimization status: the count distribution by status such as not optimized / optimized;
  • Average latency: the slowest SQL by average latency, to prioritize.
In a real sample, all 23 business SQL were of type query and status “not optimized”, with the slowest one averaging 119110.03 seconds.

Table fields

The aggregated slow query table lists each SQL with its aggregate metrics:

Filtering and sorting

Above the table there are filters: search slow SQL or ID, optimization status, SQL type, disposition stage, average latency range, and execution time range. Column headers support sorting to locate priority SQL by average latency or execution count.

Expected Result

The Slow queries page shows the aggregated backlog: a summary of counts, four distribution charts, and one table row per distinct SQL structure.

Verification

Confirm the summary, charts, and table reflect the aggregated result, and that toggling “Show business SQL only” changes the business SQL count.

Collect Slow Queries

Batch Analysis and Optimization

Track Governance Progress