lowestMin() function
The lowestMin()
function selects the minimum record from each table in the input stream and returns the lowest n
records.
It outputs a single aggregated table containing n
records.
Function type: Selector, Aggregate
lowestMin(
n:10,
column: "_value",
groupColumns: []
)
Empty tables
lowestMin()
drops empty tables.
Parameters
n
Number of records to return.
Data type: Integer
column
Column by which to sort.
Default is "_value"
.
Data type: String
groupColumns
The columns on which to group before performing the aggregation.
Default is []
.
Data type: Array of strings
Examples
from(bucket:"example-bucket")
|> range(start:-1h)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent"
)
|> lowestMin(n:10, groupColumns: ["host"])
Function definition
// _sortLimit is a helper function, which sorts and limits a table.
_sortLimit = (n, desc, columns=["_value"], tables=<-) =>
tables
|> sort(columns:columns, desc:desc)
|> limit(n:n)
// _highestOrLowest is a helper function which reduces all groups into a single
// group by specific tags and a reducer function. It then selects the highest or
// lowest records based on the column and the _sortLimit function.
// The default reducer assumes no reducing needs to be performed.
_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) =>
tables
|> group(columns:groupColumns)
|> reducer()
|> group(columns:[])
|> _sortLimit(n:n, columns:[column])
lowestMin = (n, column="_value", groupColumns=[], tables=<-) =>
tables
|> _highestOrLowest(
n:n,
column:column,
groupColumns:groupColumns,
reducer: (tables=<-) => tables |> min(column:column),
_sortLimit: bottom,
)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.