9 Jan

pgBadger is a PostgreSQL log analyzer build for speed with fully detailed reports from your PostgreSQL log file. It’s a single and small Perl script that aims to replace and outperform the old php script pgFouine.

By the way, we would like to thank Guillaume Smet for all the work he has done on this really nice tool. We’ve been using it a long time, it was a really great tool!

pgBadger is written in pure Perl language. It uses a javascript library to draw graphs so that you don’t need additional Perl modules or any other package to install. Furthermore, this library gives us more features such as zooming.

pgBadger is able to autodetect your log file format (syslog, stderr or csvlog). It is designed to parse huge log files as well as gzip compressed file. See a complete list of features below.


pgBadger reports everything about your SQL queries:

  • Overall statistics.
  • The slowest queries.
  • Queries that took up the most time.
  • The most frequent queries.
  • The most frequent errors.

The following reports are also available with hourly charts:

  • Hourly queries statistics.
  • Hourly temporary file statistics.
  • Hourly checkpoints statistics.
  • Locks statistics.
  • Queries by type (select/insert/update/delete).
  • Sessions per database/user/client.
  • Connections per database/user/client.

All charts are zoomable and can be saved as PNG images.

pgBadger supports any custom format set into log_line_prefix of your postgresql.conf file provide that you use the %t, %p and %l patterns.

If you want to save system performance you can also use log_duration instead of log_min_duration_statement to have reports on duration and number of queries only.

You can also use pgBadger to only report errors.


Sample report :

Source :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: