Section 2 · Choose and set up an integration

Monitoring PostgreSQL databases

Estimated time: 2 min

PostgreSQL integration

The PostgreSQL integration monitors connections, replication, cache, locks, and table metrics. The integration reference calls this infrastructure-level observability. For query-level detail (slow queries, wait events, and execution plans), use Database Observability.

What it’s forMonitoring queries, connections, replication, and vacuum/bloat health
Under the hoodUses the PostgreSQL exporter (prometheus.exporter.postgres) and scrapes it

Metrics collected

The integration collects these PostgreSQL metric groups:

  • Queries: Active, waiting, and duration. Waiting queries usually point to lock contention.
  • Connections: Used, available, and by state, including how close you are to max_connections.
  • Transactions: Commits, rollbacks, conflicts
  • Replication: Lag and slot status, which show whether a standby is ready for failover.
  • Vacuum: Dead tuples and autovacuum. PostgreSQL keeps old row versions until vacuum removes them, and the dashboards track that buildup.

What to know

This integration offers:

  • Prebuilt dashboards: PostgreSQL cluster overview, PostgreSQL instance overview, PostgreSQL logs, PostgreSQL query performance
  • Prebuilt alerts: connections, replication, vacuum
  • Buffer cache hit ratio
  • Query waiting and lock detection

Set it up

Open this path in your Grafana Cloud stack for a fully interactive experience, or read through it to understand the process first.

Learning path

Monitor PostgreSQL with Grafana Alloy

Welcome to the Grafana learning path that shows you how to monitor PostgreSQL databases with Grafana Alloy and use pre-built dashboards and alerts in Grafana Cloud.

18 min
Beginner
Docs & blog posts

Open in Grafana Cloud

Complete this learning path directly in your Grafana Cloud stack with an interactive learning experience.