How can I count the number of time series under each device in one SQL in IoTDB?

Viewed 28

If I have to execute count timeseries root.sg.device1/2/3 separately, that's hard work. How can I count the number of time series under each device in one SQL in IoTDB?

1 Answers

LEVEL could be defined to show count the number of timeseries of each node at the given level in the current Metadata Tree. This could be used to query the number of sensors under each device.

The grammar is:

COUNT TIMESERIES <Path> GROUP BY LEVEL=<INTEGER>

ROOT is considered as LEVEL=0.

For example, if you execute COUNT TIMESERIES root.** GROUP BY LEVEL=1 You will get the following results:

+------------+-----+
|      column|count|
+------------+-----+
|   root.sgcc|    2|
|root.turbine|    1|
|     root.ln|    4|
+------------+-----+
Related