Skip to main content
Query insights surfaces aggregated execution statistics for the queries running on a branch so you can spot slow statements, hot paths, and resource-heavy workloads at a glance. The page reads from PostgreSQL’s pg_stat_statements extension and groups statements by their normalized form, regardless of literal values.

Enable the extension

Query insights requires the pg_stat_statements extension, which must be added to the preloaded libraries for your branch before it can be used.
  1. Open the Query insights page for a branch.
  2. If the extension is not yet enabled, an Enable pg_stat_statements prompt is shown — click it to add pg_stat_statements to the preloaded libraries and create the extension. A branch restart is required to load the library.
  3. Once the branch finishes restarting, return to the Query insights page to start exploring statistics.
You can also enable the extension manually from the Extensions settings of your branch.

Queries table

The main view lists every normalized statement that pg_stat_statements has captured since it was last reset, sorted by total execution time. Click any row to open a side drawer with the full statement and metadata.

Filters

Narrow the table using the controls above the headline:
  • Search — match against the query text, database, or role.
  • Type — filter by statement type (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, OTHER).
  • Database — restrict to one or more databases on the branch.
  • User — restrict to one or more roles that ran the queries.
The row counter below the headline shows how many queries match the active filters out of the total captured.

Columns

A column selector in the toolbar lets you toggle which statistics are visible. The Query column is always shown.
ColumnDescription
QueryNormalized SQL text
DatabaseDatabase the query ran against
UserRole that executed the query
RuntimeShare of total execution time across all captured queries
CallsNumber of times the query was executed
TotalCumulative execution time
AvgMean execution time per call
MinFastest recorded execution
MaxSlowest recorded execution (highlighted when over 1s)
StddevStandard deviation of execution time
RowsTotal rows retrieved or affected
Shared Hit / Read / Dirtied / WrittenShared buffer activity
Local Hit / Read / Dirtied / WrittenLocal buffer activity (temp tables)
Temp Read / WrittenTemporary file I/O
By default, the table shows Query, Runtime, Calls, Total, Avg, Max, and Rows.

Query detail drawer

Selecting a row opens a drawer with the full statement and a summary of its execution profile:
  • Query ID — the pg_stat_statements queryid (copy with one click).
  • Full SQL — the normalized statement, formatted with syntax highlighting.
  • Database and Role.
  • Count — total calls.
  • Max time and Total exec time.
  • Cache hit ratio — computed from shared_blks_hit and shared_blks_read. A low ratio suggests the query is going to disk more than expected.

Refresh and reset statistics

The toolbar exposes two actions:
  • Refresh — re-runs the underlying query against pg_stat_statements to pull the latest counters.
  • Reset — calls pg_stat_statements_reset() to clear all captured statistics. Statistics begin rebuilding as new queries are executed. Resetting requires superuser privileges; if the action is denied, ask an administrator to run it for you.
Resetting statistics is branch-wide and cannot be undone. All historical query counters are discarded.

Availability

Query insights is available on any branch that has pg_stat_statements enabled. The page is not available while a branch is hibernated, still provisioning, or has public access disabled — in those cases, the standard branch status view is shown instead.