django-pgactivity
Monitor, kill, and analyze Postgres queries.
Decision gist · record as of 2026-08-14
Yes, if you run Django with PostgreSQL and need runtime visibility into database queries. The low install friction, permissive license, and active (if aging) maintenance make it a practical choice for production monitoring and debugging. No known vulnerabilities and broad Python/Django version support strengthen the case. The 257-day gap since last release is worth noting but not disqualifying given the repository remains active.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PostgreSQL database backend and Django project setup; works with Python 3.10 or later.
- Low install friction with a single dependency on django.
- Maintenance status is aging—last release was 257 days ago—but the repository remains active and the package supports current Python and Django versions.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use this package in commercial and proprietary projects with minimal restrictions.
last release 2025-11-30 (257 days) · last repo commit 2025-11-30 · 46 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,448,451 downloads/mo, #3,888 on PyPI
Alternatives
Verify before relying
pip install django-pgactivity
# Add 'pgactivity' to INSTALLED_APPS in settings.py
# Then use the management command:
python manage.py pgactivity
# Or in code:
from pgactivity.models import PGActivity
for activity in PGActivity.objects.all():
print(activity.pid, activity.state)- Whether the package works reliably with all advertised Django versions (4.2–6.0) in production environments.
- Performance impact of the middleware on high-traffic applications.
- Whether context annotation works correctly with async Django views.
What it is and what it does
django-pgactivity is a Django package that wraps PostgreSQL's pg_stat_activity view to give you visibility into active database queries. It provides a management command to list, filter, and control queries (cancel or terminate them), a proxy model for programmatic access, and optional middleware that attaches request metadata (URL, method) to queries so you can trace them back to your application code. You can also dynamically set statement timeouts on code blocks to prevent long-running queries.
The package is designed for Django projects using PostgreSQL and targets developers who need to monitor, debug, or manage database activity at runtime. It depends only on django and installs as a wheel with no compiled dependencies, making it straightforward to add to an existing project.
Use it for
- Identify and terminate runaway or long-running queries during production incidents.
- Debug slow endpoints by correlating slow queries with request URLs via attached context.
- Enforce query timeouts on specific operations to prevent resource exhaustion.
- Monitor idle-in-transaction connections that may be holding locks.
- Inspect active query SQL and connection metadata from a Django management command.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you run Django with PostgreSQL and need runtime visibility into database queries.
The low install friction, permissive license, and active (if aging) maintenance make it a practical choice for production monitoring and debugging. No known vulnerabilities and broad Python/Django version support strengthen the case. The 257-day gap since last release is worth noting but not disqualifying given the repository remains active.
Install
django-pgactivity on PyPI
Before you install
Low install friction with a single dependency on django. Maintenance status is aging—last release was 257 days ago—but the repository remains active and the package supports current Python and Django versions.
Requires PostgreSQL database backend and Django project setup; works with Python 3.10 or later.
License in practice
BSD-3-Clause is permissive; you can use this package in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install django-pgactivity
# Add 'pgactivity' to INSTALLED_APPS in settings.py
# Then use the management command:
python manage.py pgactivity
# Or in code:
from pgactivity.models import PGActivity
for activity in PGActivity.objects.all():
print(activity.pid, activity.state)
Verify before relying
- Whether the package works reliably with all advertised Django versions (4.2–6.0) in production environments.
- Performance impact of the middleware on high-traffic applications.
- Whether context annotation works correctly with async Django views.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release <4,>=3.10.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedjango |
| Maintenance | Aging 257 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,448,451 / month, #3,888 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14 |
Evidence: django_pgactivity-1.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “postgres query monitoring django”
- django-pgactivityProvides Django management commands and utilities to view, filter,…
- django-query-builderBuilds and executes complex SQL queries dynamically in Django…
- django-pgviews-reduxAdds first-class PostgreSQL view support to Django's ORM, allowing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Monitoring packages
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
Provides generated Python code for OpenTelemetry semantic conventions, enabling standardized attribute naming and constant definitions for instrumentation and telemetry collection.
Install it if you are using OpenTelemetry and want to follow semantic conventions correctly.
Provides the reference implementation of the OpenTelemetry API for collecting and exporting traces, metrics, and logs from Python applications.
Provides the abstract API and interfaces for OpenTelemetry instrumentation in Python, defining how to emit traces, metrics, and logs without tying code to a specific SDK implementation.
Exports OpenTelemetry observability data to an OpenTelemetry Collector using Protobuf-encoded messages over HTTP.
Install it if you are using OpenTelemetry in Python and need to send data to a Collector over HTTP.
Provides automatic instrumentation commands and programmatic APIs to inject distributed tracing into Python applications without code changes, detecting and instrumenting packages used by your program.
Install it if you need distributed tracing without code changes and have compatible instrumented packages in your environment.
See also django-pglock · django-zen-queries · django-pgmigrate · django-query-builder · django-pg-zero-downtime-migrations · django-health-check · django-queryinspect · postgres-mcp · apache-airflow-providers-postgres · django-constance