---
title: "Verify PostgreSQL data query in Grafana | Grafana Labs"
description: "Learn how to verify PostgreSQL data by running a test query in Grafana Explore."
---

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

# 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.

1. In the Grafana Cloud navigation menu, click **Explore**.
2. From the data source dropdown at the top-left, select your PostgreSQL data source.
   
   For example, select **Production PostgreSQL Database**.
3. In the query editor, enter a simple SQL query to test your connection.
   
   For example, enter:
   
   SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```sql
   SELECT datname, numbackends FROM pg_stat_database LIMIT 5
   ```
   
   **Tip:** 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.
4. Click **Run query** to execute the query.
   
   You should see the results in the table below the query editor. For more results, change the `LIMIT` from `5` to `10`.
   
   **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.

* * *

### More to explore (optional)

- [PostgreSQL query editor](/docs/grafana/latest/datasources/postgres/query-editor/)
- [Building dashboards with PostgreSQL data](/docs/grafana/latest/dashboards/)
- [Creating alerts with PostgreSQL queries](/docs/grafana/latest/datasources/postgres/alerting/)

Were you successful?

![No](/media/images/svg/thumbs-up.svg) No

![Yes](/media/images/svg/thumbs-up.svg) Yes

Super! You can move to the next step.

Please tell us what didn't work:

Submit

Submitting...

There was an error with your submission.

Thank you!

Need more support? Check out these [helpful resources.](/help/)
