# PostgresAI vs PgHero: history and wait events vs a performance dashboard

> PgHero is an open-source Postgres dashboard for slow queries and index suggestions. PostgresAI keeps history, samples wait events and files findings as Issues with a fix.

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

## Short answer

PgHero, by Andrew Kane, is an MIT-licensed performance dashboard for Postgres. It connects to a database and shows slow queries, suggested, duplicate and unused indexes, space, connections and vacuum status, with optional history of query and space stats. PostgresAI is a monitoring product with metric history, wait event analysis, scheduled checkups and Issues, hosted or self-hosted. Pick PgHero for a single-container dashboard that answers what is slow and which indexes to add or drop. Pick PostgresAI for continuous metrics, alerts, agent access and expert help.

## Where PostgresAI is ahead of PgHero

1. **Test the fix on a full-size copy first.**
   - PostgresAI: With DBLab Engine, a separate open-source product, an index or query change runs on a full-size thin clone of the database, created in seconds, before it reaches production. ([DBLab Engine](https://postgres.ai/docs/database-lab), [DBLab compared with other ways to branch](https://postgres.ai/compare#branching))
   - PgHero: PgHero estimates suggested indexes from pg_stat_statements and pg_stats, and its Explain page runs EXPLAIN, with ANALYZE opt-in, on the database it connects to. The sources we reviewed do not describe testing a change on a separate copy. [5][2]
2. **13 months of history.**
   - PostgresAI: Scale keeps 13 months of history. ([Pricing](https://postgres.ai/pricing))
   - PgHero: PgHero history is optional: you create tables and schedule tasks that capture query stats every 5 minutes and space stats once a day, and remove old rows with a cleanup task. [2][3]
3. **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))
   - PgHero: PgHero has a /health endpoint for health checks, and version 4.0 dropped its Ruby API. The sources we reviewed do not describe an MCP server or an interface for AI agents. [2][6]
4. **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))
   - PgHero: PgHero has a Live Queries page and flags queries running longer than 60 seconds by default. The sources we reviewed do not describe wait event sampling. [8][2]

## 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 | PgHero |
|---|---|---|
| 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 performance dashboard for Postgres, with pages for Overview, System, Queries, Space, Connections, Live Queries, Maintenance, Explain and Tune. It connects to one or more databases by connection URL. [1][8][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 it can connect to, running Postgres 14 or newer: version 4.0 dropped support for older versions. The guides cover self-managed servers and Amazon RDS for query stats, and CPU, IOPS and other system stats from Amazon RDS and Google Cloud SQL. Version 4.0 dropped system stats for Azure Database. [4][2][6] |
| 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. Self-hosted, as a Docker image (the guide includes a Kubernetes example) or a Rails engine mounted in your app. Version 4.0 dropped Linux packages. Historical stats are stored in tables in the monitored database or another one you choose. [1][2][3][6] |
| Open source | Yes. The monitoring software is open source under Apache 2.0. Hosted plans are a separate paid service. | Yes. Open source under the MIT license. Version 4.1.0 was released on 2026-10-20. [7][6] |
| 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. A Queries tab from pg_stat_statements, with slow-query thresholds of 20 ms average and 100 calls by default. A task you schedule every 5 minutes captures history and adds a time range slider. The Explain page runs EXPLAIN, with ANALYZE opt-in and a 10-second default timeout. [2][3][4][6] |
| 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: not documented. A Live Queries page lists running queries, and the overview flags long running queries (60 seconds by default). The sources we reviewed do not describe wait event sampling. [8][2][9] |
| 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: yes. The overview checks long running queries, high connections and connections idle in transaction, replication lag, inactive replication slots, cache hit rate, vacuuming, columns near integer overflow, invalid indexes and constraints, and duplicate, unused and suggested indexes and slow queries. Suggested indexes need pg_query and query stats. [9][3][5] |
| 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. A /health endpoint for health checks. Version 4.0 dropped the Ruby API. The sources we reviewed do not describe an MCP server or an interface for AI agents. [2][6] |
| 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: not documented. Suggested indexes are estimated from pg_stat_statements and pg_stats, and EXPLAIN runs on the database PgHero connects to. The sources we reviewed do not describe testing a change on a separate copy. [5][2] |
| 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. | Not documented in the sources we reviewed. The README invites bug reports and pull requests on GitHub. [1] |
| Alerts | Email and Slack alerts on Starter and Scale. | The dashboard shows warnings, such as total connections above a threshold of 500 by default. The sources we reviewed do not describe alert notifications. [2][9] |
| History kept | 14 days on Starter, 13 months on Scale, custom on Enterprise. | History is optional and kept for as long as you choose: the guides show removing query stats older than 14 days and space stats older than 90 days. [2][3] |
| 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. | PgHero is software you run yourself. The sources we reviewed do not describe security attestations. [1] |

## When PgHero is the better choice

- Open source under the MIT license and free; one Docker container or a gem mounted in a Rails app.
- Suggested indexes: it parses the most time-consuming queries from pg_stat_statements and uses pg_stats estimates to propose an index.
- One overview page flags long running queries, connections, replication lag, vacuuming, columns near integer overflow, invalid indexes and constraints, duplicate, unused and suggested indexes, and slow queries.
- An Explain page runs EXPLAIN, with EXPLAIN ANALYZE opt-in, and links to a plan visualizer; a Tune page lists current settings and links to PgTune.
- System stats such as CPU and IOPS from Amazon RDS and Google Cloud SQL in the same dashboard.

## 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 |
| PgHero | Open source | Free | MIT license; you run the Docker image or Rails engine [7][1] |

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

## Using both

Both read pg_stat_statements and can point at the same database. DBLab, a separate product, copies any PostgreSQL source, so an index PgHero suggests can be created on a full-size DBLab clone and the query timed there before production.

## Questions

### Is PgHero open source?

Yes. PgHero is open source under the MIT license, maintained by Andrew Kane, and runs as a Docker image or a Rails engine. [7][1]

### Does PgHero work with Amazon RDS?

Yes. The query stats guide covers enabling pg_stat_statements on Amazon RDS through a parameter group, and PgHero can show CPU, IOPS and other system stats from RDS through CloudWatch. [4][2]

### Does PgHero keep history?

Optionally. You create tables for query and space stats and schedule capture tasks, every 5 minutes for queries and daily for space. A cleanup task removes old rows; the guides use 14 and 90 days as examples. [2][3]

### Can I use PostgresAI and PgHero together?

Yes. They read the same statistics and can watch the same database. DBLab, the PostgresAI cloning product, copies any PostgreSQL source, so an index PgHero suggests can be tested on a full-size clone before production.

## Sources for PostgresAI

- [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)
- [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)
- [Wait event analysis dashboard](https://postgres.ai/docs/monitoring/dashboards/wait-events)
- [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)
- [Checkup reports](https://postgres.ai/docs/checkup)
- [How to work with Issues](https://postgres.ai/docs/postgresai-howtos/how-to-work-with-issues)
- [Postgres consulting](https://postgres.ai/consulting)
- [Security and compliance](https://postgres.ai/security)

## Sources for PgHero

1. [PgHero repository README](https://github.com/ankane/pghero)
2. [PgHero Docker guide](https://github.com/ankane/pghero/blob/master/guides/Docker.md)
3. [PgHero Rails guide](https://github.com/ankane/pghero/blob/master/guides/Rails.md)
4. [PgHero query stats guide](https://github.com/ankane/pghero/blob/master/guides/Query-Stats.md)
5. [How PgHero suggests indexes](https://github.com/ankane/pghero/blob/master/guides/Suggested-Indexes.md)
6. [PgHero changelog](https://github.com/ankane/pghero/blob/master/CHANGELOG.md)
7. [PgHero license](https://github.com/ankane/pghero/blob/master/LICENSE.txt)
8. [PgHero source: dashboard navigation](https://github.com/ankane/pghero/blob/master/app/views/layouts/pg_hero/application.html.erb)
9. [PgHero source: overview page](https://github.com/ankane/pghero/blob/master/app/views/pg_hero/home/index.html.erb)

## 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.
