---
title: "PostgreSQL with Database Observability | Grafana Labs"
description: "Set up Database Observability for PostgreSQL"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# PostgreSQL with Database Observability

Database Observability gives you deep visibility into PostgreSQL query performance. This slide’s path is for a database you run yourself.

|                      |                                                                                                                                                                             |
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **What it monitors** | Query performance, explain plans, wait events, query samples, table schemas                                                                                                 |
| **How it works**     | Grafana Alloy reads from `pg_stat_statements` and `pg_stat_activity`                                                                                                        |
| **What you see**     | Top queries by duration, explain plans with cost highlighting, wait events, query samples                                                                                   |
| **This path**        | Self-managed PostgreSQL 14 or later                                                                                                                                         |
| **Managed services** | Amazon RDS, Amazon Aurora, Google Cloud SQL, and Azure Database each have a [setup guide](/docs/grafana-cloud/monitor-applications/database-observability/set-up/postgres/) |

## What you’ll get

- **Queries Overview dashboard** showing RED metrics for tracked queries
- **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. Parameters are redacted by default.
- **Table schemas** showing structures, indexes, and constraints

## Before you start

A few things to keep in mind:

- **PostgreSQL 14 or later** is required.
- Load `pg_stat_statements` in `shared_preload_libraries`. Changing that setting requires a restart. Then create the extension in each database you want to monitor.
- Query statistics need the `pg_monitor` and `pg_read_all_stats` roles.
- Schema details and explain plans also need `USAGE` on each schema and `SELECT` on all tables in that schema, or the `pg_read_all_data` role if you want every object.
- Amazon RDS, Amazon Aurora, Google Cloud SQL, and Azure Database use a [separate setup guide](/docs/grafana-cloud/monitor-applications/database-observability/set-up/postgres/), not this path.

The path below walks you through each step.

* * *

Learning path

#### PostgreSQL Database Observability

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

15 min

Intermediate

Docs &amp; blog posts

#### Open in Grafana Cloud

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

[Open in Grafana Cloud]()

[View on website](/docs/learning-paths/postgresql-db-olly/)

[Path completed](/docs/learning-hub/intro-to-db-olly/02-database-observability/10-resources/)
