pg_activity
pg_activity is a terminal-based monitoring tool for PostgreSQL that displays real-time server activity similar to the Unix 'top' command. It provides visibility into running queries, resource consumption, and system metrics with an interactive CLI interface.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | dalibo/pg_activity |
| Owner | dalibo |
| Primary language | Python |
| License | PostgreSQL — Requires review (not clearly OSI) |
| Stars | 3k |
| Forks | 191 |
| Open issues | 15 |
| Latest release | v3.6.2 (2026-06-05) |
| Last updated | 2026-07-02 |
| Source | https://github.com/dalibo/pg_activity |
What pg_activity is
Python-based CLI tool that connects to PostgreSQL via psycopg driver, queries pg_stat_statements and system catalogs, and renders live activity data in a sortable, filterable terminal UI. Requires superuser or elevated OS permissions for full visibility into system resources and temporary files.
Get the pg_activity source
Clone the repository and explore it locally.
git clone https://github.com/dalibo/pg_activity.gitcd pg_activity# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Python 3.x runtime; install via pip, package managers (apt, yum), or pipx for isolated environments.
- Connect with superuser PostgreSQL account to access system information and tempfile data; fallback to degraded mode with standard user.
- Run with OS-level superuser (sudo) or as postgres system user for local execution to read system metrics accurately.
- Configure track_activity_query_size parameter if query text appears truncated; default 1024 bytes may be insufficient.
- Supports AWS RDS with --rds flag; filters rdsadmin database and disables tempfile monitoring for RDS limitations.
When to avoid it — and what to weigh
- Large-scale Multi-instance Monitoring — Not designed for centralized monitoring of hundreds of database instances; better served by dedicated monitoring platforms.
- Persistent Historical Analysis — Tool is real-time only with no built-in time-series storage; use Prometheus/Grafana for historical trending and alerting.
- Highly Restrictive Database Access — Requires superuser or equivalent privileges for full functionality; degraded mode with reduced visibility if permissions are limited.
- Automated Alert and Escalation — No native alerting; requires manual observation or external scripting to trigger automated responses.
License & commercial use
Licensed under PostgreSQL License (also known as the Postgres License). This is a permissive open-source license allowing modification, distribution, and private use with minimal restrictions.
PostgreSQL License permits commercial use. However, verify compatibility with your specific commercial deployment terms and consult legal review if required by your organization's policy.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
Tool queries live database activity; requires secure credential handling (connection strings, environment variables). Superuser access needed for full visibility—consider using dedicated read-only monitoring role if feasible. No explicit security audit or CVE history provided in data; review project security advisories before production use.
Alternatives to consider
pgAdmin
Web-based PostgreSQL management; broader feature set but heavier deployment and network overhead.
DBeaver
Desktop IDE with activity monitoring; more feature-rich but requires GUI and local installation.
Prometheus + pg_exporter
Centralized monitoring with time-series storage and alerting; better for multi-instance and historical analysis.
Build on pg_activity with DEV.co software developers
Integrate pg_activity into your development and operations workflow. Contact our team for guidance on deployment in your environment.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
pg_activity FAQ
Can pg_activity monitor remote PostgreSQL instances?
What permissions does the PostgreSQL user need?
Does pg_activity store historical data?
Is pg_activity suitable for production monitoring?
Software developers & web developers for hire
DEV.co helps companies turn open-source tools like pg_activity into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.
Ready to Monitor PostgreSQL Activity?
Integrate pg_activity into your development and operations workflow. Contact our team for guidance on deployment in your environment.