keyValues() function

The keyValues() function returns a table with the input table’s group key plus two columns, _key and _value, that correspond to unique column + value pairs from the input table.

Function type: Transformation

keyValues(keyColumns: ["usage_idle", "usage_user"])



A list of columns from which values are extracted. All columns indicated must be of the same type. Each input table must have all of the columns listed by the keyColumns parameter.

Data type: Array of strings


Get key values from explicitly defined columns
from(bucket: "example-bucket")
  |> range(start: -30m)
  |> filter(fn: (r) => r._measurement == "cpu")
  |> keyValues(keyColumns: ["usage_idle", "usage_user"])

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.