Querious Docs

Server Activity View — PostgreSQL

The Activity view shows every connection to the server, along with the server's background processes, and the state and current query of each. It's the first place to look for what is currently happening on the server when there are slow queries, connection pile-ups, or stalled transactions.

The Activity view
The Activity view

Connection History Chart #

The connection history is a stacked area chart of connection counts over time. Each entry listed in the Activity view is counted in exactly one category:

Category What it means
Active The connection is executing a query.
Idle in Txn

The connection is inside an open transaction (has executed BEGIN) but is not currently running a query.

These hold locks and can block other work, so a rising number of these is worth investigating.

Idle The connection is connected and doing nothing.
Background

A process that runs inside the server itself rather than a client connection, such as the checkpointer, background writer, or WAL writer.

PostgreSQL 10 and later list these in the same view as client connections. They have no state of their own, so any entry without a state of Active, Idle, or Idle in Txn is counted here.

Connections List #

The table shows one row per connection (or server background process).

Column What it shows
PID The server-defined "process ID".
Database The database the connection is using.
User The user the connection is connected as.
Wait Event If a connection is blocked, this is what it's waiting for (ex: Lock: relation).
Duration For active connections, this is how long the current query has been running. For others, how long in the current state.
Query The most recent query text, on one line. Select the row to see all of it in the pane below the table.
State The state of the connection; One of those listed above.

Refreshing #

The view refreshes automatically. Use the play/pause button in the bottom bar to pause and resume, and the refresh button () to reload immediately.

Cancelling or Terminating #

To act on connections, select one or more and right-click them, or use the action menu ( ) in the bottom bar.

Command What it does
Stop Query Cancels the current query and returns an error to the client. The connection stays open.
Kill Connection Closes the connection entirely, after a confirmation.

Both commands need the pg_signal_backend privilege or superuser.

Options #

In the action menu in the bottom bar is the option:

  • Show Full Query — When on, selecting any connection will display the full text of the query, otherwise it is limited to just 500 characters.