4.1k stars · PostgreSQL License · v13.2 (2025-12-29), read from /releases/latest on 2026-09-12 with the year shown in full
It reads PostgreSQL's own log file and produces one HTML page naming the slowest queries, in order.
▶Repo detailsthe review · specs · pros & cons · install
What it is
pgBadger is a single program that reads PostgreSQL log files and produces a self-contained HTML report. The report shows the slowest queries, the most frequent ones, connection counts, locks and errors, with charts over time.What it is good for. Anyone whose own app is getting slower and who does not know why. It answers the question directly instead of asking you to install monitoring and wait a week. It costs nothing to run, it does not stay running, and the report is one file you can open on a laptop. Grasppy maps long conversations, which is exactly the kind of work that ends up doing too many small database queries in a loop. This will show you if that is happening.
- It works on log files you already have, so it can tell you something about last week.
- It leaves nothing running on the server. You run it, you read the page, it is over.
- The report is a single HTML file. No database, no server, no dashboard to maintain.
- To get a useful report you must first switch on query logging in PostgreSQL. That writes more to disk, so watch your free space for a day.
- It is written in Perl, an older programming language. It installs fine, but it is not a
pip install. - The last tagged release was 29 December 2025. That is normal for a mature tool, but it means there is no recent release to point at.
# Debian and Ubuntu package it directly: sudo apt update sudo apt install pgbadger # Switch on query logging in postgresql.conf: # log_min_duration_statement = 0 # log_line_prefix = '%t [%p]: user=%u,db=%d,app=%a,client=%h ' # log_checkpoints = on # log_lock_waits = on # log_temp_files = 0 # Reload PostgreSQL, let it run for a day, then: pgbadger /var/log/postgresql/postgresql-16-main.log -o ~/report.html