# PostgresAI vs postgres_exporter and Grafana: Issues vs your own rules

> postgres_exporter, Prometheus and Grafana form a metrics stack you assemble yourself. PostgresAI pairs each finding with a fix and keeps 13 months of history on Scale.

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

## Short answer

postgres_exporter exposes PostgreSQL metrics for Prometheus to scrape; Grafana draws dashboards and Alertmanager sends alerts. Every part is free and open source, and you choose the collectors, dashboards, alert rules and retention. The repository includes a mixin with alert rules and a Grafana dashboard. PostgresAI monitoring comes assembled, with collection, storage and pre-built Grafana dashboards (with Scale on hosted plans), and adds scheduled checkups that become Issues. Pick the exporter stack if you already run Prometheus and want full control. Pick PostgresAI for Postgres checkups, Issues and expert help.

## Where PostgresAI is ahead of postgres_exporter and Grafana

1. **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))
   - postgres_exporter and Grafana: The postgres_exporter repository includes a mixin with alert rules such as PostgreSQLSlowQueries and PostgresTablesNotVaccumed; its README calls it a work in progress. The sources we reviewed do not describe recommendations or fixes. [3][14]
2. **13 months of history.**
   - PostgresAI: Scale keeps 13 months of history. ([Pricing](https://postgres.ai/pricing))
   - postgres_exporter and Grafana: Prometheus keeps 15 days by default when neither a retention time nor a size is set. Its docs say local storage is not clustered or replicated; longer history uses a remote storage integration. [5]
3. **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))
   - postgres_exporter and Grafana: postgres_exporter exposes metrics from PostgreSQL statistics views for Prometheus to scrape. The sources we reviewed do not describe running an index or query change on a separate copy of the data. [11]

## 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 | postgres_exporter and Grafana |
|---|---|---|
| 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 stack you assemble: postgres_exporter exposes PostgreSQL server metrics on port 9187, Prometheus scrapes and stores them, Grafana draws dashboards, and Alertmanager sends notifications. The exporter repository includes a mixin with alerting and recording rules and a Grafana dashboard. [1][2][6] |
| 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. The exporter connects as a regular database user; from PostgreSQL 10 its role is granted pg_monitor, or the narrower pg_read_all_stats. CI tests PostgreSQL 13 to 18. A guide covers Amazon RDS, Aurora collectors are off by default, and a multi-target mode is meant for cases where a sidecar is not possible, for example SaaS-managed services. [11][12][13][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. You run every part: the exporter as a binary or the quay.io/prometheuscommunity/postgres-exporter image, Prometheus, Alertmanager and Grafana. The stat_statements collector does not export query text unless include_query is enabled. [1][6] |
| Open source | Yes. The monitoring software is open source under Apache 2.0. Hosted plans are a separate paid service. | Yes. postgres_exporter and Prometheus are under Apache 2.0. Grafana is distributed under AGPL-3.0-only, with Apache 2.0 exceptions listed in its LICENSING.md. [1][9][10] |
| 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: partly. A stat_statements collector reads pg_stat_statements, but it is disabled by default. When enabled it returns up to 100 statements by default, by queryId; query text is off by default and cut to 120 characters when on. Dashboards for it are yours to build. [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: yes. The stat_activity collector, on by default, exports session counts from pg_stat_activity labeled by state, wait_event_type and wait_event at each scrape. Dashboards for it are yours to build. [4][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: partly. The mixin defines alert rules, among them PostgreSQLDown, PostgreSQLHighConnections, PostgreSQLSlowQueries, PostgreSQLCacheHitRatio, PostgresHasHighDeadLocks, PostgresReplicationLaggingMore1Hour, PostgresHasReplicationSlotUsed and PostgresTablesNotVaccumed; its README calls it a work in progress. The sources we reviewed do not describe recommendations or fixes. [3][14] |
| 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. | Not documented in the sources we reviewed. [1][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. | Not documented in the sources we reviewed. [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. | Not documented in the sources we reviewed. [1] |
| Alerts | Email and Slack alerts on Starter and Scale. | You write alerting rules as PromQL expressions in Prometheus, which sends alerts to Alertmanager. Alertmanager receivers include email, Slack, PagerDuty, Opsgenie, Microsoft Teams, Discord, Telegram, Jira, Amazon SNS and webhooks. [7][6][8] |
| History kept | 14 days on Starter, 13 months on Scale, custom on Enterprise. | Prometheus keeps 15 days by default when neither a retention time nor a size is set. Local storage is not clustered or replicated; remote storage integrations can keep longer history. [5] |
| 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. | Not documented in the sources we reviewed. The stack is software you run in your own environment. [1] |

## When postgres_exporter and Grafana is the better choice

- Free and open source: postgres_exporter and Prometheus under Apache 2.0, Grafana under AGPL-3.0-only.
- The stat_activity collector, on by default, exports session counts by state, wait_event_type and wait_event at every scrape.
- Alertmanager can notify email, Slack, PagerDuty, Opsgenie, Microsoft Teams, Discord, Telegram, Jira, webhooks and more, with silencing, inhibition and aggregation.
- Collectors are switched on and off one by one, including Amazon Aurora collectors, and a multi-target mode lets one exporter probe managed services where a sidecar is not possible.
- Full control over retention, scrape intervals, dashboards and alert thresholds.

## 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 |
| postgres_exporter and Grafana | Open source | Free | postgres_exporter and Prometheus under Apache 2.0, Grafana under AGPL-3.0-only; you run and operate all parts [1][9][10] |

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

## Using both

Both use Grafana for dashboards. A team with Prometheus and postgres_exporter can keep its metrics and alert rules and add PostgresAI checkups and Issues for the same databases.

## Questions

### Is postgres_exporter free?

Yes. postgres_exporter and Prometheus are open source under Apache 2.0, and Grafana under AGPL-3.0-only. You run and operate them yourself. PostgresAI monitoring is also open source under Apache 2.0, with paid hosted plans. [1][9][10]

### Does postgres_exporter collect pg_stat_statements?

Yes, through the stat_statements collector, which is disabled by default. It returns up to 100 statements by default; query text is off unless include_query is enabled, and is cut to 120 characters. [1]

### Does postgres_exporter come with dashboards and alerts?

The exporter repository includes postgres_mixin, which builds Prometheus alert and recording rules and Grafana dashboard JSON with mixtool. Notifications go through Alertmanager, which you configure. [2][6]

### How long does Prometheus keep metrics?

15 days by default, if neither storage.tsdb.retention.time nor storage.tsdb.retention.size is set. Longer history needs more local disk or a remote storage integration. [5]

### Can I use PostgresAI and postgres_exporter together?

Yes. Both read PostgreSQL statistics, and both use Grafana for dashboards. A team can keep postgres_exporter alert rules in Prometheus and add PostgresAI checkups and Issues. [1]

## Sources for PostgresAI

- [Checkup reports](https://postgres.ai/docs/checkup)
- [How to work with Issues](https://postgres.ai/docs/postgresai-howtos/how-to-work-with-issues)
- [Pricing](https://postgres.ai/pricing)
- [DBLab Engine](https://postgres.ai/docs/database-lab)
- [DBLab compared with other ways to branch](https://postgres.ai/compare#branching)
- [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)
- [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)
- [Postgres consulting](https://postgres.ai/consulting)
- [Security and compliance](https://postgres.ai/security)

## Sources for postgres_exporter and Grafana

1. [postgres_exporter repository and README](https://github.com/prometheus-community/postgres_exporter)
2. [postgres_exporter: postgres_mixin](https://github.com/prometheus-community/postgres_exporter/tree/master/postgres_mixin)
3. [postgres_mixin alert rules (source)](https://raw.githubusercontent.com/prometheus-community/postgres_exporter/master/postgres_mixin/alerts/postgres.libsonnet)
4. [postgres_exporter stat_activity collector (source, v0.21.0)](https://raw.githubusercontent.com/prometheus-community/postgres_exporter/v0.21.0/collector/pg_stat_activity.go)
5. [Prometheus documentation: storage](https://prometheus.io/docs/prometheus/latest/storage/)
6. [Prometheus documentation: alerting overview](https://prometheus.io/docs/alerting/latest/overview/)
7. [Prometheus documentation: alerting rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)
8. [Alertmanager configuration](https://prometheus.io/docs/alerting/latest/configuration/)
9. [Prometheus repository](https://github.com/prometheus/prometheus)
10. [Grafana repository](https://github.com/grafana/grafana)
11. [postgres_exporter documentation: overview](https://github.com/prometheus-community/postgres_exporter/blob/master/docs/README.md)
12. [postgres_exporter documentation: database permissions](https://github.com/prometheus-community/postgres_exporter/blob/master/docs/database-permissions.md)
13. [postgres_exporter documentation: AWS RDS](https://github.com/prometheus-community/postgres_exporter/blob/master/docs/aws-rds.md)
14. [postgres_mixin README](https://github.com/prometheus-community/postgres_exporter/blob/master/postgres_mixin/README.md)

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