---
title: "PostgreSQL configuration impact | Database Observability documentation"
description: "Understand how PostgreSQL configuration commands affect Database Observability dashboards and panels."
---

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

# PostgreSQL configuration impact

This reference explains how each PostgreSQL configuration command affects the dashboards and panels in Database Observability. Use this information to understand why each permission, extension, and setting is needed and what breaks if a configuration is missing.

## Summary

The following table summarizes the impact of each configuration on Database Observability:

Expand table

| Configuration                                           | Dashboards and panels affected | If missing                                    |
|---------------------------------------------------------|--------------------------------|-----------------------------------------------|
| `pg_stat_statements` extension                          | All (Overview, Query Details)  | App non-functional                            |
| `pg_stat_statements.track = all` or `top`               | Overview, Query Details        | No or partial query data                      |
| `pg_monitor` role                                       | All                            | Cannot read statistics                        |
| `pg_read_all_stats` role                                | All                            | Cannot read statistics                        |
| `pg_stat_statements.track = 'none'` for monitoring user | Overview (noise reduction)     | Alloy queries visible, ~5-10% extra telemetry |

## Enable the `pg_stat_statements` extension

**Command:**

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
```

**Purpose:**

The `pg_stat_statements` extension is where PostgreSQL stores internal telemetry about query execution. This extension tracks execution statistics of all SQL statements executed by the database.

**Dashboard impact:**

This extension is required for the entire Database Observability app to work. It powers:

- The entire **Overview Page**, including RED metrics (Rate, Errors, Duration) about queries
- Query text display
- Query metrics such as rows count, blocks read, and blocks hit
- The majority of the **Query Details** page

**If missing:**

The Database Observability app is non-functional. No query data is collected or displayed.

## Configure the `pg_stat_statements.track` setting

**Commands:**

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
-- Track all SQL statements (recommended)
ALTER SYSTEM SET pg_stat_statements.track = 'all';

-- Or track only top-level statements
ALTER SYSTEM SET pg_stat_statements.track = 'top';
```

**Purpose:**

This setting controls which SQL queries are tracked in `pg_stat_statements`:

- `all`: Track all SQL statements, including those inside functions and procedures
- `top`: Track only top-level statements (queries issued directly by clients)
- `none`: Disable tracking entirely

**Dashboard impact:**

- With `all`: All SQL statements appear in the Overview and Query Details pages
- With `top`: Most statements appear, but some nested statements inside functions are excluded

**If set to `none`:**

The `pg_stat_statements` view is empty and the Overview page shows no data.

> Note
> 
> The default value is `top`, which is acceptable for most use cases. Setting it to `all` provides more comprehensive tracking but may have a small performance overhead.

## Grant the `pg_monitor` role

**Command:**

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
GRANT pg_monitor TO "db-o11y";
```

**Purpose:**

The `pg_monitor` role is a built-in PostgreSQL role that allows the monitoring user to read statistics and call stats-related functions. Refer to the [PostgreSQL documentation on default roles](https://www.postgresql.org/docs/current/default-roles.html) for more details.

**Dashboard impact:**

This grant affects the entire Database Observability app. Without it, the monitoring user may be unable to read:

- `pg_stat_statements` views
- `pg_stat_activity` views
- Other statistics required for monitoring

**If missing:**

The whole app is impacted. Dashboards may show no data or partial data depending on which statistics are inaccessible.

## Grant the `pg_read_all_stats` role

**Command:**

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
GRANT pg_read_all_stats TO "db-o11y";
```

**Purpose:**

The `pg_read_all_stats` role allows the monitoring user to read all statistics views and use various statistics-related functions. This role is included in `pg_monitor`, but granting it explicitly ensures the monitoring user has the necessary permissions.

**Dashboard impact:**

Similar to `pg_monitor`, this grant ensures the monitoring user can read all required statistics.

**If missing:**

Partial or no data appears in dashboards.

## Disable tracking for the monitoring user

**Command:**

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
ALTER ROLE "db-o11y" SET pg_stat_statements.track = 'none';
```

**Purpose:**

This setting ensures the monitoring user (`db-o11y`) doesn’t generate statistics about its own queries. Without this setting, the queries that Alloy runs to gather data from `pg_stat_statements` and other tables appear in the UI.

**Dashboard impact:**

With this setting enabled:

- Alloy monitoring queries don’t appear in the Overview page
- Queries from Alloy don’t have dedicated Query Details pages
- All panels in the Overview show only application queries

**If missing:**

- Alloy monitoring queries appear in the Overview page alongside application queries
- This creates noise in dashboards and increases telemetry volume by approximately 5-10% (varies based on workload)

> Note
> 
> This setting is optional but recommended. The telemetry savings depend on your workload characteristics.

## About `pg_stat_activity`

**Related configuration:**

`pg_stat_activity` doesn’t require separate configuration. It’s automatically enabled when PostgreSQL is running and works alongside `pg_stat_statements`.

**Dashboard impact:**

Data from `pg_stat_activity` powers the sample collection feature, which provides:

- **Samples tab** in the Query Details page
- **Wait Events tab** in the Query Details page

**If issues arise:**

Verify that the monitoring user has the `pg_monitor` or `pg_read_all_stats` role, which grants access to `pg_stat_activity`.

## Related documentation

- [Set up PostgreSQL](/docs/grafana-cloud/monitor-applications/database-observability/set-up/postgres/): Complete setup instructions for PostgreSQL monitoring
- [Troubleshoot PostgreSQL](/docs/grafana-cloud/monitor-applications/database-observability/troubleshoot/postgres/): Validate PostgreSQL configuration
