Verify PostgreSQL data query in Grafana
In this milestone, you verify that your PostgreSQL data source works correctly by running a test query in Grafana’s Explore feature.
In the Grafana Cloud navigation menu, click Explore.
From the data source dropdown at the top-left, select your PostgreSQL data source.
For example, select Production PostgreSQL Database.
In the query editor, enter a simple SQL query to test your connection.
For example, enter:
SELECT datname, numbackends FROM pg_stat_database LIMIT 5Tip: If the editor is in Builder mode, switch to Code mode first. You can use any valid SQL query that your PostgreSQL user has permission to run.
Click Run query to execute the query.
You should see the results in the table below the query editor. For more results, change the
LIMITfrom5to10.Did you know? Grafana’s Explore feature is perfect for testing queries and exploring your data before you build dashboards.
Verify successful data access
After running your test query, you should see:
- Query results displayed in the Explore interface
- No connection errors or timeouts
- Data that matches what you expect from your PostgreSQL database
- The ability to run different SQL queries successfully
Congratulations! You’ve successfully connected your PostgreSQL database to Grafana Cloud.