Influx Query - return number of unique series in measurement

Hi,
I am using influxDB 1.8 and am struggling to find a query that I can use in the influxdb client tool to return the number of unique series in a measurement. I tried the following query, but it does not work on measurements that contain a lot of data:

Select count(“count”) from (select count(Value) from measurementName group by “Id”)

Does anyone know of a query that can be used to get the total number / count of unique series in a measurement?

For anyone else who might be interested, this query seems to work:
SHOW SERIES CARDINALITY

More info/ background:
“Series cardinality is the number of unique database, measurement, tag set, and field key combinations in an InfluxDB instance.
For example, assume that an InfluxDB instance has a single database and one measurement. The single measurement has two tag keys: email and status . If there are three different email s, and each email address is associated with two different status es then the series cardinality for the measurement is 6 (3 * 2 = 6)” (InfluxDB glossary | InfluxDB OSS 1.8 Documentation)

1 Like

OK, this is definitely useful but it shows the cardinality for the whole database.

Is there a way to get the series cardinality of a single measurement?

I believe the closest thing is to show the number of series per measurement:

SHOW SERIES FROM <measurement name>

@jpowers
Unfortunately, SHOW SERIES query does not show the number of series but it actually tries to list all the series. This doesn’t help much for measurements with a lot of series in them.

After asking the question yesterday, I kept digging and discovered that the query below seems to do exactly what I needed:

SHOW SERIES CARDINALITY FROM <measurement_name>

I wasn’t expecting it to be that simple but it works.

1 Like

Ah thanks for following up!