Documentation

distinct() function

The distinct() function returns the unique values for a given column. The _value of each output record is set to the distinct value in the specified column. null is considered its own distinct value if it is present.

Function type: Selector
Output data type: Record

distinct(column: "host")

Empty tables

distinct() drops empty tables.

Parameters

column

Column on which to track unique values.

Data type: string

Examples

from(bucket: "example-bucket")
	|> range(start: -5m)
	|> filter(fn: (r) => r._measurement == "cpu")
	|> distinct(column: "host")

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: