PostgreSQL statement details

Use the statement details to see one PostgreSQL statement: its text, its history, and the sessions that run it now.

Before you begin

  • Scops identifies a statement by its query_id in one database. The text and the counts come from pg_stat_statements (see PostgreSQL permissions).
  • PostgreSQL keeps no execution plan and counts no CPU time for a statement. The panel has no plan and no CPU tab.

Open the statement details

Click a statement on one of these pages:

The panel opens at the right. To go to a section, click its name in the list at the left.

Read the header

The header shows the query_id and the first word of the text, for example SELECT. Then it shows these facts:

FactWhat it shows
StatusRunning now, Not running now, or Last seen and the time.
SessionsThe sessions that run it in the newest sample.
UserThe roles that it ran as.
DatabaseThe database of the statement.

Read the text

Statement Text shows the text that pg_stat_statements keeps, with $1, $2 in place of the constants. A long text shows its first part only. If pg_stat_statements no longer held the text when Scops read the statement, the section says so.

Read the history

  1. In History, select a tab.

  2. For a tab other than Activity, select the range: 1D or 1W.

  3. To zoom, drag across the chart. To go back, click Reset Zoom.

TabWhat it shows
ActivityThe average active backends of the statement, by wait event type. From the Dashboard, it shows the window of the Dashboard, or its last 24 hours when the window is longer. From the other pages, it shows the last hour.
ElapsedThe mean time of one call: total_exec_time divided by the calls.
ExecutionsThe calls in each ten minutes.
DiskThe shared blocks that one call read in (shared_blks_read).
GetsThe shared blocks that one call used, found or read in.
RowsThe rows that one call returned or changed.
TableEach ten-minute interval as a row, with the values for one call, the temp blocks and the WAL bytes.

A break in a line means that the statement did not run. The figures at the right of the tabs summarize the range, for example Average, Fastest, Slowest and Last.

Table shows I/O Time / Exec only when track_io_timing is on. It shows Planning Time / Exec only when pg_stat_statements.track_planning is on.

See who runs it now

Right Now lists the sessions that run the statement in the newest sample. Each row shows the pid, user, wait, elapsed time, blocker, application and client. The client local means a connection over a Unix socket.

Read the recent samples

  1. In Samples, click Show Samples.

The list shows each sample of the last 15 minutes that saw the statement, with the time, the session and its state.

Updated November 22, 2026