About queries
Queries are how Grafana panels communicate with data sources to get data for the visualization. A query is a question written in the query language used by the data source. How often the query is sent to the data source and how many data points are collected can be adjusted in the panel data source options.
Use you a query editor to write a query. Each data source has its own query editor that we have customized to include the features and capabilities of the data source. Grafana supports up to 26 queries per panel.
Important! You must be familiar with the query language of the data source. For more information about data sources, refer to Data sources.
Query editors
Depending on your data source, the query editor might provide auto-completion, metric names, or variable suggestions.
Because of the difference between query languages, data sources have query editors that look different. Here are two examples of query editors.
InfluxDB query editor

Prometheus (PromQL) query editor

Query syntax
Data sources use different query languages to return data. Here are two query examples:
PostgreSQL
SELECT hostname FROM host WHERE region IN($region)
PromQL
query_result(max_over_time(<metric>[${__range_s}s]) != <state>)
Data sources used in queries
In addition to the data sources that you have configured in Grafana, there are three special data sources available:
- Grafana - A built-in data source that generates random walk data, which can be useful for testing visualizations and running experiments.
- Mixed - Select this option to query multiple data sources in the same panel. When you select this data source, Grafana enables you to select a data source for every new query that you add.
- The first query uses the data source that was selected before you selected Mixed.
- You cannot change an existing query to use the Mixed Data Source.
- Dashboard - Select this option to use a result set from another panel in the same dashboard.
You can combine data from multiple data sources onto a single dashboard, but each panel is tied to a specific data source that belongs to a particular Organization.
Related Grafana resources
Getting started with Grafana 8
Grafana 8.0 is here! Join us for a live walkthrough on how to get started using Grafana 8 and the Grafana 8 user interface while showing how to set up monitoring for a web service that uses Prometheus and Loki to store metrics and logs.
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.