InfluxQL selector functions
Use selector functions to assess, select, and return values in your data. Selector functions return one or more rows with the selected values from each InfluxQL group.
Examples use the sample data set provided in the Get started with InfluxDB tutorial.
Missing InfluxQL functions
Some InfluxQL functions are in the process of being rearchitected to work with the InfluxDB IOx storage engine. If a function you need is not here, check the InfluxQL feature support page for more information.
FIRST()
Returns the field value with the oldest timestamp.
FIRST(field_expression)
Arguments
- field_expression: Expression to identify one or more fields to operate on.
Can be a field key,
constant, regular expression, or wildcard (
*
). Supports all field data types.
Notable behaviors
Examples
LAST()
Returns the field value with the most recent timestamp.
LAST(field_expression)
Arguments
- field_expression: Expression to identify one or more fields to operate on.
Can be a field key,
constant, regular expression, or wildcard (
*
). Supports all field data types.
Notable behaviors
Examples
MAX()
Returns the greatest field value.
MAX(field_expression)
Arguments
- field_expression: Expression to identify one or more fields to operate on.
Can be a field key,
constant, regular expression, or wildcard (
*
). Supports numeric fields.
Notable behaviors
Examples
MIN()
Returns the lowest field value.
MIN(field_expression)
Arguments
- field_expression: Expression to identify one or more fields to operate on.
Can be a field key,
constant, regular expression, or wildcard (
*
). Supports numeric fields.
Notable behaviors
Examples
Notable behaviors of selector functions
Timestamps when grouping by time
When using selector functions with a GROUP BY time()
clause, most selector
functions return the timestamp of the starting boundary for each time interval.
However functions with an N
argument that specifies the number of results to
return per group maintain the original timestamp of each returned point.
Was this page helpful?
Thank you for your feedback!
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, use the following resources:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.