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:
SELECT * FROM pg_extension WHERE extname = 'pg_stat_statements';- If it’s missing, refer to the Enable pg_stat_statements section in the get started article.
Confirm track_activity_query_size
Verify the value is 4096:
show track_activity_query_size;
track_activity_query_size
---------------------------
4kB- If the value differs, refer to the Increase
track_activity_query_sizesection in the get started article.
Validate monitoring user and base privileges
Verify that the monitoring user can query pg_stat_statements:
-- run with the `db-o11y` user
SELECT * FROM pg_stat_statements LIMIT 1;- If this query fails, refer to the Create a monitoring user and grant required privileges section in the get started article.
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.
- If a schema lacks detailed data, refer to the Grant object privileges for detailed data section in the get started article.
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.



