PostgreSQL Live Activity
Use Live Activity to see the sessions of one PostgreSQL instance now, find who blocks whom, and follow long commands and deadlocks.
Before you begin
- You need the View PostgreSQL and View Live Activity permissions. Open the page with Live Activity in the database bar, or from the Sessions window of the Dashboard.
- To show one database, select it in the database bar. All databases shows the full instance.
- The page only reads. It does not change anything on the instance.
Find a session
The Sessions tab lists the sessions that work now, the longest first. The line above the list counts the active, idle in transaction and blocked sessions.
To add the idle sessions, turn on Idle sessions.
To add the processes of the server, such as the checkpointer, turn on Server processes.
To put the session with the oldest transaction first, click oldest transaction in the line above the list.
To show more columns, such as Xmin Age, click Columns. Click Save to keep your choice.
A session that blocks a different session, and a session that waits on a lock, always show.
What the columns mean
| Column | What it shows |
|---|---|
| Elapsed | How long the statement runs, or how long the session is idle. Amber when the session is idle in a transaction for more than 10 minutes. |
| Session | The pid. A tag shows the parallel workers of the session, or the type of a server process. Expand the row to see the workers. |
| Statement | The query_id. Click it to open the statement details. Work without a query_id shows its name. |
| Waiting On | The wait, for example Lock: transactionid, On CPU, or the state of a session that runs nothing. |
| Blocked By | The pid of the session that holds the lock. The word prepared means a prepared transaction, which has no session. |
| Transaction | How long its transaction is open. Amber after one hour. |
| Program, Machine, State | The application_name, the client address and the state of the session. |
| Xmin Age | How many transactions back the session holds vacuum. Hidden by default. |
Refresh the data
Each tab shows the time of its data (Sampled) and a refresh button. To refresh the open tab automatically, open the menu at the right of the tab bar. Select Every 5 s, Every 15 s or Every 60 s. The default is Off.
Look back with History
On the Sessions or Blocking tab, click History.
Set the start and the end, one hour apart at most. The default is the last hour.
Click Run.
On Sessions, each row is one session in one sample, the newest first. On Blocking, you see the chains at the end of the interval, without the lock that each session waited for. To go back to now, click Real Time.
Find the root of a lock chain
The Blocking tab shows each lock wait as a chain. The root holds the lock, and the sessions under it wait. The chain with the most sessions behind it is first.
| Item | What it shows |
|---|---|
| blocks 3 | The sessions that wait behind this session, also further down the chain. |
| Waiting | How long a waiter waits. Amber from one minute, red from five minutes. |
| Waiting On | For the root: what it does, for example idle in transaction and for how long. Amber when it is idle in a transaction for more than 10 minutes. |
| prepared transaction | The root is a prepared transaction, with its name. Point to it to see its owner and database. |
To hide the sessions behind a session, click its arrow. If a root is idle in a transaction, the line above the chains names it first.
Follow a long command
The Progress tab lists the commands that report their progress: VACUUM, ANALYZE, CREATE INDEX, CLUSTER, base backups and COPY. PostgreSQL reports progress only for these commands.
| Column | What it shows |
|---|---|
| Command | The command, for example autovacuum: VACUUM (to prevent wraparound). A vacuum to prevent wraparound does not stop for other sessions. If you end it, it starts again. |
| Relation | The table. |
| Phase | The phase, the step (for example index 2 of 5), and the session that a CREATE INDEX waits for. |
| Progress | The percent done. When PostgreSQL gives no percent, the count so far, for example of rows. |
Read the deadlocks
Click the Deadlocks tab.
Select a period: 1D, 1W or 1M.
Click a row. The Deadlock panel shows each process: what it waited for, who held it, and its statement. It also shows which statement the server ended.
PostgreSQL writes the details of a deadlock only in its server log. Scops reads the log over SSH, so the list needs an OS credential on the instance (see PostgreSQL permissions). Scops reads the log again once a minute at most.
Related
Updated November 22, 2026