Just making sure I am not missing anything.

In InfluxDB v1 we used to rely on the SHOW SERIES CARDINALITY.
The same query does not seem to be implemented in v2 and I have found: influxdb.cardinality() function | InfluxDB OSS 2.0 Documentation

That seems to be limited to InfluxDB Cloud version only. Is there something available in InfluxDB OSS v2.0.4 for that purpose ?

Or would I need to implement this using the following: schema.tagValues() function | InfluxDB OSS 2.0 Documentation

Thanks in advance,

@0liver The influxdb.cardinality() function depends on an API that hasn’t been added to InfluxDB 2.0 yet. In the mean time, you can use a query similar to the following to return the total series cardinality within a time range. Fair warning, this could be a fairly heavy query depending on your data.

By default, from() returns results grouped by series (measurement, tag set, and field key). The example below uses first() to limit each table (series) to a single row, and then group() to group all rows into a single table, and then count() to count the number of rows in the table. That should give you series cardinality.

from(bucket: "example-bucket")
  |> range(start: -1y)
  |> first()
  |> group()
  |> count()
1 Like