Documentation

experimental.quantile() function

The experimental.quantile() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.quantile() function outputs non-null records with values in the _value column that fall within the specified quantile or represent the specified quantile. Which it returns depends on the method used. The _value column must contain float values.

Function type: Aggregate or Selector

import "experimental"

experimental.quantile(
  q: 0.99,
  method: "estimate_tdigest",
  compression: 1000.0
)

When using the estimate_tdigest or exact_mean methods, the function outputs non-null records with values that fall within the specified quantile.

When using the exact_selector method, it outputs the non-null record with the value that represents the specified quantile.

Parameters

q

A value between 0 and 1 thats specifies the quantile.

Data type: Float

method

Computation method. Default is estimate_tdigest.

Data type: String

Available options:

estimate_tdigest

An aggregate method that uses a t-digest data structure to compute an accurate quantile estimate on large data sources.

exact_mean

An aggregate method that takes the average of the two points closest to the quantile value.

exact_selector

A selector method that returns the data point for which at least q points are less than.

compression

Indicates how many centroids to use when compressing the dataset. A larger number produces a more accurate result at the cost of increased memory requirements. Defaults to 1000.0.

Data type: Float

Examples

Quantile as an aggregate
import "experimental"

from(bucket: "example-bucket")
	|> range(start: -5m)
	|> filter(fn: (r) =>
    r._measurement == "example-measurement" and
    r._field == "example-field")
	|> experimental.quantile(
    q: 0.99,
    method: "estimate_tdigest",
    compression: 1000.0
  )
Quantile as a selector
import "experimental"

from(bucket: "example-bucket")
	|> range(start: -5m)
	|> filter(fn: (r) =>
    r._measurement == "example-measurement" and
    r._field == "example-field")
	|> experimental.quantile(
    q: 0.99,
    method: "exact_selector"
  )

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: