pg_stat_statements extension and groups statements by their normalized form, regardless of literal values.
Enable the extension
Query insights requires thepg_stat_statements extension, which must be added to the preloaded libraries for your branch before it can be used.
- Open the Query insights page for a branch.
- If the extension is not yet enabled, an Enable pg_stat_statements prompt is shown — click it to add
pg_stat_statementsto the preloaded libraries and create the extension. A branch restart is required to load the library. - Once the branch finishes restarting, return to the Query insights page to start exploring statistics.
Queries table
The main view lists every normalized statement thatpg_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.
Columns
A column selector in the toolbar lets you toggle which statistics are visible. The Query column is always shown.
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_statementsqueryid(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_hitandshared_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_statementsto 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.
Availability
Query insights is available on any branch that haspg_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.