Skip to content

Top queries & explorer

pg_stat_statements reports one row per statement shape. QueryPilot normalizes each statement again (tokenizing it, replacing literals with ?, collapsing whitespace and comments, and lowercasing unquoted words for identity) and hashes the canonical text with SHA-256. That fingerprint is stable across restarts, machines and QueryPilot versions, so a query’s history never splits in two.

Each query is classified as SELECT, INSERT, UPDATE, DELETE, DDL, UTILITY, OTHER or UNKNOWN.

On every database page, Top queries — last hour shows the five queries with the most total execution time in the last hour: normalized text, statement type, calls, mean and estimated p95. Total time is the right default ranking: a 2 ms query called a million times usually costs more than a 2 s query called twice. Select a row to open the query page.

Open query explorer lists every query of the database with figures for the selected window.

Column Meaning
Query Normalized text (or the fingerprint when text collection is off).
Type Statement type.
Calls, Calls/min Executions in the window.
Mean Exact mean execution time in the window.
p95 (est.) Estimated 95th percentile.
Total time Execution time summed over the window.
Rows/call Rows per execution.
Cache hit Shared buffer hits ÷ shared blocks touched.
Read blocks Shared blocks read from disk.

All counters are deltas within the window, not lifetime totals from pg_stat_statements. An amber dot marks a query first observed inside the window.

  • Time range: last 15 minutes, 1 hour (default), 6 hours, 24 hours, 7 days, or a custom range.
  • Search: a substring of the query text, or a fingerprint prefix.
  • Statement type: facet chips with a count per type; select several.
  • Numeric thresholds: minimum calls, minimum and maximum mean time, minimum total time.
  • Sort: total time (default), mean time, calls, rows, I/O or temp usage, descending or ascending.

Active filters are shown as removable pills, and Clear filters resets them. All filter state is in the URL, so a filtered view can be bookmarked or shared.

Results are cursor-paginated with Next and Previous, a total count, and a page size of up to 200 (default 50). While a new page or filter loads, the previous results stay on screen, dimmed.

Terminal window
curl -s "http://localhost:8080/api/v1/databases/<id>/queries?range=24h&statementType=SELECT,UPDATE&minCalls=100&sort=mean_time&order=desc&limit=20"

See the API reference for every parameter.