Data and databases · Edition No. 23 · 17 Sep 2026

dalibo/pg_activity

A top-like terminal screen showing every query a PostgreSQL server is running right now, with the ability to cancel one.

← Data and databasesRead the whole edition →

3.0k stars · PostgreSQL licence · v3.6.2 (2026-06-05), read from /releases/latest; the date showed no year and falls in the past, so 2026 · Track this in Scout

A top-like terminal screen showing every query a PostgreSQL server is running right now, with the ability to cancel one.

Repo detailsthe review · specs · pros & cons · install

What it is

A terminal program in the style of top, the standard tool for watching what a computer is doing. It connects to PostgreSQL and refreshes a list of active queries, showing the user, the database, the duration, the state, whether a query is blocked by another one, and read and write activity. It can cancel or terminate a query from the same screen, and it can record what it saw to a CSV file for later.What it is good for. Anyone who runs their own database and has had a slow afternoon with no explanation. The problem it removes is the delay between something going wrong and knowing what is wrong. pgBadger from Edition 18 reads yesterday's log and tells you which queries are usually slow. This is the other half: it tells you what is happening this minute, including the query that is holding a lock and stopping everything else. Being able to end that one query from the same screen is often the whole fix.

Stars3.0k
LicencePostgreSQL licence
Latestv3.6.2 (2026-06-05), read from /releases/latest; the date showed no year and falls in the past, so 2026
Good
  • It shows waiting and blocking clearly, which is the single most useful thing when a site has stopped rather than slowed.
  • You can cancel or kill a query without opening a second connection and looking up its number.
  • The PostgreSQL licence is as permissive as MIT, and it is packaged for Debian and Ubuntu already.
Watch for
  • It shows you now and nothing else. There is no history unless you record it to a file yourself.
  • Without a superuser account it runs in a reduced mode and hides some of the most useful columns.
  • It is a terminal program, so it is a tool for you and not a dashboard for anybody else.
Similar repositories
Install
# Debian or Ubuntu:
sudo apt install pg-activity
# Or with pipx, which keeps it out of your system Python:
pipx install "pg_activity[psycopg]"
# Or in a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install "pg_activity[psycopg]"
# Watch a local database:
sudo -u postgres pg_activity -U postgres
# Watch a remote one:
pg_activity -h your-server -p 5432 -U postgres -d grasppy
Screenshots
dalibo/pg_activity: GitHub preview carddalibo/pg_activity: Screenshot 1

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.