Grafana Cloud

Troubleshoot PostgreSQL

Identify and resolve issues from each step of the PostgreSQL get started guide. Use these checks to verify your database configuration and confirm that Grafana Alloy is wired correctly. These steps do not repeat setup. If a setting is incorrect, refer back to the corresponding step in the get started article to apply the change.

What you’ll achieve

In this article, you:

  • Validate PostgreSQL extensions, user permissions, and object access.
  • Confirm track_activity_query_size.
  • Troubleshoot Alloy configuration for logs and metrics forwarding.

Before you begin

Make sure you can connect to your PostgreSQL server and have sufficient privileges to run validation queries. Keep the PostgreSQL get started article open to reapply any missing configuration.

Verify pg_stat_statements is enabled

Check that the extension exists in each monitored database:

SQL
SELECT * FROM pg_extension WHERE extname = 'pg_stat_statements';

Confirm track_activity_query_size

Verify the value is 4096:

SQL
show track_activity_query_size;

 track_activity_query_size
---------------------------
 4kB

Validate monitoring user and base privileges

Verify that the monitoring user can query pg_stat_statements:

SQL
-- run with the `db-o11y` user
SELECT * FROM pg_stat_statements LIMIT 1;

Check object-level access for detailed data

Ensure the monitoring user has USAGE and SELECT on relevant schemas and tables, or a role that grants access to all objects.

Troubleshoot Alloy configuration

Validate component wiring, labels, scrape targets, and write endpoints. For guidance on exporters, components, relabeling, scrape jobs, and remote writes, refer to Troubleshoot Alloy components.

Next steps

For setup instructions, refer to Set up PostgreSQL.