Slide 5 of 6

PostgreSQL with Database Observability

PostgreSQL with Database Observability

Database Observability gives you deep visibility into PostgreSQL query performance, whether your database is self-managed or running on a managed cloud service.

What it monitorsQuery performance, wait events, connections, replication lag, table bloat
How it worksGrafana Alloy reads from pg_stat_statements and pg_stat_activity
What you seeTop queries by duration, explain plans with cost highlighting, wait events, query samples
Supported variantsSelf-managed PostgreSQL 14+, Amazon RDS, Amazon Aurora, Google Cloud SQL, Azure Database

What you’ll get

  • Queries Overview dashboard showing RED metrics for every query
  • Explain plans with visual graphs showing scan types, join strategies, and cost distribution
  • Wait events categorized by I/O, lock, and network waits from pg_stat_activity
  • Query samples with individual execution timing and parameters
  • Table schemas showing structures, indexes, and constraints

Trade-offs

StrengthsConsiderations
Deepest PostgreSQL visibility available in Grafana CloudRequires PostgreSQL 14+
Visual explain plans with cost-coded operation nodespg_stat_statements extension must be installed (requires restart)
Wait events from pg_stat_activityRequires a monitoring user with pg_monitor and pg_read_all_stats roles
Managed database support (RDS, Aurora, CloudSQL, Azure)First-time setup takes 30-60 minutes
AI-powered optimization suggestionsUses Grafana Alloy as collection agent

Learning path

PostgreSQL Database Observability

Set up Grafana Cloud Database Observability for PostgreSQL to monitor query performance, explain plans, wait events, and query samples.

13 min
Intermediate
Docs & blog posts

Open in Grafana Cloud

Complete this learning path directly in your Grafana Cloud stack, or in the Grafana Play stack, with an interactive learning experience.

Path completed

Script

If you’re running PostgreSQL, this is where you can set it up. Database Observability reads from pg_stat_statements for aggregate query statistics and pg_stat_activity for active session information. It works with self-managed PostgreSQL, Amazon RDS, Aurora, Google Cloud SQL, and Azure Database.

You’ll get the same powerful tools: a Queries Overview dashboard, visual explain plans with cost-coded nodes, wait events categorized by I/O, lock, and network waits, and query samples with individual timing and parameters.

A few things to keep in mind. PostgreSQL 14 or later is required. The pg_stat_statements extension needs to be installed, which requires a database restart the first time. And you’ll need a monitoring user with the pg_monitor and pg_read_all_stats roles. Setup typically takes 30 to 60 minutes.

When you’re ready, the learning path below walks you through the setup step by step.