min()
Calculates the minimum value among the values returned by an expression.
Syntax
Parameters
EXPR- An expression that returns the values from which to find the minimum.
Description
The min() function evaluates EXPR for each record and returns the smallest value. Numeric comparisons track the minimum for integers (integer, long) and floating-point numbers (double) separately. Non-numeric values (strings, timestamps, etc.) can also be compared using the internal ObjectComparator. Null values are ignored. If all input values are null, it returns null.
Use this function in aggregation commands such as stats and timechart.
Error codes
| Code | Description |
|---|---|
| 91020 | The number of arguments is incorrect. |
Usage examples
To prepare the WEB_APACHE_SAMPLE table used in these examples, refer to Preparing sample data.
-
Find the minimum response size across all requests
table WEB_APACHE_SAMPLE | stats min(bytes) -
Find the minimum response size per HTTP status code
table WEB_APACHE_SAMPLE | stats min(bytes) by status -
Null value handling
json "[{'val': 10}, {'val': null}, {'val': 30}]" | stats min(val) | # min(val): 10
Compatibility
The min() function has been available since before Logpresso Sonar 4.0.