# PostgresAI vs pgBadger: continuous monitoring vs log file reports

> pgBadger is an open-source PostgreSQL log analyzer that builds HTML reports from log files. PostgresAI monitors continuously and files findings as Issues with a fix.

Checked on 2026-11-18. Page: https://postgres.ai/compare/postgresai-vs-pgbadger. All comparisons: https://postgres.ai/compare.

## Short answer

pgBadger, by Gilles Darold, is a PostgreSQL log analyzer: a Perl script that reads PostgreSQL and PgBouncer log files and writes HTML reports on slow queries, errors, locks, checkpoints, autovacuum and connections. It works from log files after the fact and answers a different question: what the logs say happened. PostgresAI collects statistics continuously, samples wait events and turns checkup findings into Issues. The two can run side by side; pick pgBadger when you need per-statement detail from logs, and add monitoring for live metrics and alerts.

## Where PostgresAI is ahead of pgBadger

1. **Wait events with no extra extension.**
   - PostgresAI: An ASH-style wait event dashboard built from samples of pg_stat_activity. No extra extension is needed. ([Wait event analysis dashboard](https://postgres.ai/docs/monitoring/dashboards/wait-events))
   - pgBadger: pgBadger reports lock waits from the logs when log_lock_waits is on: the most frequent waiting queries and the queries that waited the most. The sources we reviewed do not describe wait event sampling. [1]
2. **An AI agent can work through the findings.**
   - PostgresAI: The postgresai CLI and an MCP server give an agent the Issues, action items and checkup reports. The setup guide covers Cursor, Claude Code, Windsurf and Codex. ([How to install MCP for AI coding tools](https://postgres.ai/docs/postgresai-howtos/how-to-install-mcp), [PostgresAI CLI reference](https://postgres.ai/docs/reference-guides/postgresai-cli-reference))
   - pgBadger: pgBadger can write its reports as JSON for other tools to read. The sources we reviewed do not describe an MCP server or an interface for AI agents. [1]
3. **Every finding comes with a fix.**
   - PostgresAI: Scheduled checkups turn each finding into an Issue with severity, evidence and a specific fix. ([Checkup reports](https://postgres.ai/docs/checkup), [How to work with Issues](https://postgres.ai/docs/postgresai-howtos/how-to-work-with-issues))
   - pgBadger: pgBadger reports on checkpoints, autovacuum per table, temporary files, cancelled queries and errors by class. The sources we reviewed do not describe recommendations or fixes for what it finds. [1]

## Check it on your own database

```
npx postgresai@latest checkup postgresql://user@host:5432/db --no-upload
```

The express checkup works with PostgreSQL 14 or newer. With --no-upload it needs no account and sends no report data to PostgresAI. It needs Node.js 18 or newer and a database role with pg_monitor. Compare what it finds with what your current tool shows for the same database.

- [Live demo (login demo, password demo)](https://demo.postgres.ai)
- [Checkup command reference](https://postgres.ai/docs/reference-guides/postgresai-cli-reference#command-checkup)

## Side by side

| | PostgresAI | pgBadger |
|---|---|---|
| What it is | PostgreSQL monitoring with scheduled health checkups. Findings become Issues with severity, evidence and a recommended fix, which you, your AI agent or a PostgresAI expert can act on. | A PostgreSQL log analyzer: a standalone Perl script that parses PostgreSQL and PgBouncer log files and writes HTML, JSON, text or binary reports. It runs when you call it, for example from cron, and can build daily and weekly incremental reports. [1][2] |
| Where your Postgres can run, and which versions | Any provider: yes. Amazon RDS and Aurora, Google Cloud SQL, Azure Database for PostgreSQL, Supabase, Tiger Data, self-managed servers and Postgres running on Kubernetes. PostgreSQL 14 and newer, with the pg_stat_statements extension. | Any provider: yes. Any server whose logs you can read: local files, remote files over SSH, journalctl output, Heroku logplex streams, Amazon RDS and CloudWatch logs, and Cloud SQL and CloudNativePG JSON logs. [1] |
| Where it runs and what it collects | Self-hosted option: yes. Hosted by PostgresAI, or self-hosted in your own cloud account or on your own server. It collects database metadata such as statistics, normalized query texts and wait events, not table data or query parameters. | Self-hosted option: yes. Runs on your own machine with Perl; charts render in the browser. Optional Perl modules are needed for CSV input and JSON output. It works from log files, which can be fetched from remote hosts over SSH. [1] |
| Open source | Yes. The monitoring software is open source under Apache 2.0. Hosted plans are a separate paid service. | Yes. Free software under the PostgreSQL Licence. Version 13.3 was released on 2026-11-03. [1][4][3] |
| Query performance analysis | Query analysis: yes. Top queries from pg_stat_statements by calls, execution time, planning time and rows, with a drill-down dashboard for a single query. For execution plans, Joe runs EXPLAIN on a DBLab clone. | Query analysis: yes. From logged statements: slowest queries, queries that took the most time, most frequent queries, histograms of query times and prepare/bind statistics. Needs log_min_duration_statement; it also processes auto_explain output and links to a graphical explain tool. [1] |
| Wait event analysis | Wait events: yes. An ASH-style wait event dashboard built from samples of pg_stat_activity. No extra extension is needed. | Wait events: partly. With log_lock_waits on, reports show the most frequent waiting queries, the queries that waited the most and lock statistics. The sources we reviewed do not describe wait event sampling. [1] |
| Health checks and recommendations | Health checks: yes. Scheduled checkup reports on settings, autovacuum and bloat, and indexes (invalid, unused, redundant). Each finding becomes an Issue with severity, evidence and a specific fix. | Health checks: not documented. Reports cover checkpoints, autovacuum and autoanalyze per table, temporary files, cancelled queries and errors by class. The sources we reviewed do not describe recommendations or scheduled checks. [1] |
| AI and agent access | Agent access: yes. The postgresai CLI (alias pgai) and an MCP server with tools for Issues, action items and checkup reports. The setup guide covers Cursor, Claude Code, Windsurf and Codex. | Agent access: not documented. Reports can be written as JSON for other tools to read. The sources we reviewed do not describe an MCP server or an interface for AI agents. [1] |
| Testing a fix before production | Test on a copy: yes. With DBLab Engine, a separate open-source product: a full-size thin clone of the database in seconds, where an index or query change can be run on real data. DBLab is set up and priced separately. | Test on a copy: does not apply. pgBadger reports on statements that already ran and were logged. The sources we reviewed do not describe testing changes. [1] |
| Human PostgreSQL experts | Human experts: yes. Scale includes two expert requests a month, answered within 24 business hours. Either plan can buy a one-off pack of two requests for $500. Consulting is separate. | Human experts: not documented. The pgBadger site points readers to the PostgreSQL Professional Services list for commercial support. The sources we reviewed do not describe support offered by the maintainer. [2] |
| Alerts | Email and Slack alerts on Starter and Scale. | Watch mode (-w) reports only errors, like logwatch. The sources we reviewed do not describe alert notifications. [1] |
| History kept | 14 days on Starter, 13 months on Scale, custom on Enterprise. | Reports are files you keep. In incremental mode, --retention sets the number of weeks to keep; the default, 0, disables removal. [1] |
| Security attestations | SOC 2 Type 2 examination completed for the Security and Availability criteria, covering March 4 to June 4, 2026. The SOC 3 report is public. | pgBadger is software you run yourself. The sources we reviewed do not describe security attestations. [1] |

## When pgBadger is the better choice

- Open source under the PostgreSQL Licence; a single Perl script with no server, agent or database to run.
- Reports from logs cover what statistics views do not keep: errors by class, cancelled queries, lock waits, temporary files, checkpoints, autovacuum per table, sessions and connections.
- Reads log formats from stderr, csvlog, jsonlog and syslog to Amazon RDS, Cloud SQL, Heroku logplex and CloudNativePG, from local files, SSH or journalctl.
- Parses PgBouncer logs into reports on throughput, sessions, connections and pools.
- Incremental mode builds a daily report and a cumulative weekly report, and can process logs in parallel on several CPUs.

## Pricing

| Product | Plan | List price | Notes |
|---|---|---|---|
| PostgresAI | Starter | $16 per cluster/month | Primary only, 14-day retention, no expert requests included |
| PostgresAI | Scale | $512 per cluster/month | Primary and up to 5 replicas in one cluster, 13-month retention, Grafana dashboards, 2 expert requests a month |
| PostgresAI | Enterprise | Custom | Contact sales |
| PostgresAI | Self-hosted | No licence fee | Open source under Apache 2.0; you run it yourself |
| pgBadger | Open source | Free | PostgreSQL Licence; a Perl script you run [1][4] |

PostgresAI prices: https://postgres.ai/pricing.

## Using both

pgBadger and PostgresAI answer different questions and run side by side: pgBadger reads PostgreSQL logs, which needs settings such as log_min_duration_statement, while PostgresAI monitoring reads statistics views and needs pg_stat_statements. A slow query found in either can be tested on a full-size DBLab clone, since DBLab copies any PostgreSQL source.

## Questions

### Is pgBadger a monitoring tool?

pgBadger is a log analyzer. It builds reports from PostgreSQL log files when you run it, for example daily from cron in incremental mode. It reads log files and does not sample live metrics, so it can run alongside a monitoring tool. [1]

### Does pgBadger work with Amazon RDS?

Yes. pgBadger has an rds log format that auto-detects Amazon RDS and CloudWatch PostgreSQL logs. It also reads Cloud SQL and CloudNativePG JSON logs and Heroku logplex streams. [1]

### What PostgreSQL settings does pgBadger need?

Query logging through log_min_duration_statement, a log_line_prefix with a time and a process escape, and, for fuller reports, log_checkpoints, log_connections, log_disconnections, log_lock_waits, log_temp_files and log_autovacuum_min_duration. Log messages must be in English. [1]

### Can I use PostgresAI and pgBadger together?

Yes. pgBadger reads logs and PostgresAI monitoring reads statistics views, so both can run against the same server. DBLab, the PostgresAI cloning product, can then test a fix for a slow query on a full-size clone.

## Sources for PostgresAI

- [Wait event analysis dashboard](https://postgres.ai/docs/monitoring/dashboards/wait-events)
- [How to install MCP for AI coding tools](https://postgres.ai/docs/postgresai-howtos/how-to-install-mcp)
- [PostgresAI CLI reference](https://postgres.ai/docs/reference-guides/postgresai-cli-reference)
- [Checkup reports](https://postgres.ai/docs/checkup)
- [How to work with Issues](https://postgres.ai/docs/postgresai-howtos/how-to-work-with-issues)
- [PostgresAI monitoring overview](https://postgres.ai/docs/monitoring)
- [What are Issues?](https://postgres.ai/docs/questions-and-answers)
- [Monitoring quick start](https://postgres.ai/docs/monitoring/getting-started)
- [Data privacy: metadata only](https://postgres.ai/docs/monitoring#data-privacy-metadata-only)
- [postgresai repository](https://gitlab.com/postgres-ai/postgresai)
- [Query performance analysis dashboard](https://postgres.ai/docs/monitoring/dashboards/query-analysis)
- [Joe bot](https://postgres.ai/docs/joe-bot)
- [DBLab Engine](https://postgres.ai/docs/database-lab)
- [DBLab compared with other ways to branch](https://postgres.ai/compare#branching)
- [Pricing](https://postgres.ai/pricing)
- [Postgres consulting](https://postgres.ai/consulting)
- [Security and compliance](https://postgres.ai/security)

## Sources for pgBadger

1. [pgBadger repository README](https://github.com/darold/pgbadger)
2. [pgBadger website](https://pgbadger.darold.net/)
3. [pgBadger ChangeLog](https://github.com/darold/pgbadger/blob/master/ChangeLog)
4. [pgBadger license](https://github.com/darold/pgbadger/blob/master/LICENSE)

## How we compare

These pages compare what each product does for PostgreSQL; other databases and the rest of the stack are out of scope. What we say about the other product comes from its own documentation, pricing page, changelog or source repository, read on the date shown; each row cites its source. "Not documented" means we did not find it in those sources, not that the product cannot do it. Prices are list prices and the billing units differ, so they are not a total-cost comparison. Product names are trademarks of their owners.
