Search code examples
influxdbgrafana

Select from multiple measurements


I have a bunch of measurements, all starting with task_runtime. i.e.

task_runtime.task_a task_runtime.task_b task_runtime.task_c

Is there a way to select all of them by a partial measurement name?

I'm using grafana on top of influxdb and I want to display all of these measurements in a single graph, but I don't have a closed list of these measurements.

I thought about something like

select * from (select table_name from all_tables where table_name like "task_runtime.*")

But not sure on the influxdb syntax for this


Solution

  • You can use a regular expression when specifying measurements in the FROM clause as described in the InfluxDB documentation.

    For example, in your case:

    SELECT * FROM /^task_runtime.*/
    

    Grafana also supports this and will display all measurements separately.