Querious Help 5

Server Statements View — PostgreSQL

The Statements view shows execution statistics for every distinct query pattern since statistics were last reset, powered by the pg_stat_statements extension. Use it to find the queries consuming the most total time, with the highest average latency, or called most often.

The Statements view
The Statements view

Requiring pg_stat_statements #

The standard pg_stat_statements extension must be installed on the server. If it isn't, you'll need to run:

CREATE EXTENSION pg_stat_statements;

Charts #

The charts at the top of the view show measurements of the top N query patterns. (Choose Top 10 / 20 / 50 / All). Hover over any donut slice or bar in the charts for the exact value and query text. Clicking on one will select that statement in the list below.

  • Total Time: cumulative time. The best chart for finding queries worth optimizing, since a query run thousands of times a day with a mediocre plan often dominates.
  • Mean Time: average latency per call. Spots individual slow queries.
  • Calls: the most frequently called patterns.

Statement List #

The statement list shows one row per distinct query pattern. For example, literal values are normalized, so two otherwise identical queries ending with WHERE id = 1 and WHERE id = 2 are part of the same "query pattern."

Column What it shows
Total Time The execution time of all queries matching this pattern.
Calls The number of executions of queries of this pattern.
Mean The average time per call. Orange above 100 ms, red above 1 second.
Min, Max The fastest and slowest single executions.
Rows The total number of rows returned or affected.
Query The normalized query. Select a row to see all of it, copyable, in the pane below the table.

Resetting Statistics #

Choose Reset Statistics in the action menu ( ) to start a fresh window. Reset before measuring a change.