Part 1/3
PGBadger is a revolutionary tool for analysing PostgreSQL logs that makes this important but often tedious task much more efficient and insightful. For database administrators, analysing logs is essential to ensure smooth operations, but without the right tools it can feel like searching for a needle in a haystack. PGBadger simplifies this process by providing powerful visualisations, unmatched speed and comprehensive insights.
This article is the first part of a series dedicated to PGBadger. Here we will learn what makes PGBadger an indispensable tool for analysing PostgreSQL logs, what features it offers and what new features have been introduced in version 13.0. In the next part, we compare PGBadger with other PostgreSQL monitoring tools to help you choose the best solution for your needs.
What makes PGBadger so special?
- Unrivalled speed
PGBadger is optimised for performance. It can process gigabytes of logs within minutes by distributing the workload across multiple threads. For high-volume databases — such as those that process thousands of transactions per second — this speed is a key advantage. Whether you’re dealing with standard logs or compressed files, PGBadger handles them effortlessly. - Effortless setup
All you need is Perl and a PostgreSQL log file. Since there are no additional dependencies or complex integrations, it’s ideal for environments where simplicity is key. Even non-experts can get it up and running with just a few commands. - Comprehensive visualisation
PGBadger creates detailed HTML reports with interactive graphs and charts that provide information such as- Query performance: Highlights the slowest queries with execution times and frequency.
- Error Tracking: Breaks down errors such as failed connections or unexpected events so you can pinpoint issues.
- Load distribution: Shows activity peaks and troughs over the course of a day or week.
- Support for a wide range of log formats
Whether you use syslog, stderr or csvlog, PGBadger adapts seamlessly. It’s a versatile tool that works with most PostgreSQL configurations. - Customisable reports
Recent updates (from version 13.0) offer even more flexibility, such as:- Custom histograms for detailed analysis of session or query time.
- Improved support for auto_explain plans, providing deeper insights into query execution.
What’s new in PGBadger 13.0?
The latest version of PGBadger introduces several exciting features:
- Custom Histograms
The new--histogram-query
and--histogram-session
options allow users to define specific intervals for query and session times, tailoring insights to their workload. - Improved Auto_explain support
PGBadger now supports Auto_explain plans in CSV and JSON log formats. This means you can analyse query execution plans directly from your logs, giving you better insight into how to optimise your queries. - Enhanced event logging
New event categories include:
- unexpected EOF
- incomplete startup package
- deadlock while waiting for…
These additions provide a more comprehensive picture of database behaviour and help administrators to identify and resolve problems more quickly.
Coming Up in Part 2
PGBadger stands out as a fast, user-friendly, and highly versatile tool for PostgreSQL log analysis. Its powerful visualisations, support for various log formats, and recent updates in version 13.0 make it a go-to solution for many database administrators.
However, it’s not the only tool in the PostgreSQL ecosystem. In the next article of this series, we’ll dive into alternative monitoring solutions like TimescaleDB with Grafana and OpenTelemetry, as well as cloud-native tools such as AWS CloudWatch, Azure Monitor, and GCP Logging. You’ll learn how these tools complement PGBadger or serve as standalone solutions tailored to specific use cases.
PGBadger is a fantastic tool, but choosing the right solution depends on your specific needs. At Baremon, we specialise in PostgreSQL database optimisation and the integration of advanced monitoring tools.
Contact us to discuss how we can improve the performance of your database.