pg_activity

pg_activity is a top like application for PostgreSQL server activity monitoring.

What is pg_activity?

pg_activity is a top like application for PostgreSQL server activity monitoring.

Overview of pg_activity

What it is

pg_activity is a command-line tool for monitoring PostgreSQL server activity. It provides a top-like interface that displays real-time information about database processes, queries, and system resources.

Key features

  • Displays a real-time, refreshable process table with columns for PID, database, user, client, CPU%, MEM%, read/write rates, query duration, and wait status.
  • Shows header information including instance details, system information (CPU, memory, swap, I/O), and worker process counts.
  • Supports filtering activities by database name using regular expressions.
  • Allows customization of displayed columns and header sections via command-line options or configuration files.
  • Can store running queries as CSV output.
  • Offers built-in display profiles (narrow, wide, minimal) and user-defined configuration profiles.
  • Supports AWS RDS with the --rds flag, which disables tempfile display and filters out the rdsadmin database.

Use cases

  • Real-time monitoring of PostgreSQL server performance and query activity.
  • Troubleshooting slow queries, high resource usage, or blocking sessions.
  • Observing system-level impact of database operations.
  • Auditing or logging running queries for later analysis.

Getting started

Install via distribution package (e.g., Debian/Ubuntu): $ sudo apt install pg-activity Install via pip with psycopg: $ python3 -m pip install 'pg_activity[psycopg]' Run locally as the postgres system user: $ sudo -u postgres pg_activity -U postgres For full usage details, see the repository README.

License and pricing

The license is PostgreSQL. The software is open source and free.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/dalibopg-activity.svg)](https://yunodb.com/tools/dalibopg-activity?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/dalibopg-activity?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/dalibopg-activity.svg" alt="Featured on YunoDB" height="20"></a>