STD_DEV_EACH
The standard deviation of the value per group.
STD_DEV_EACH ([MAX VALUES, ]GROUP, VALUE)
MAX VALUES:
The maximum number of groups (Default: 2,147,483,647).
Groups beyond this amount will be discarded. In some cases, depending on the data
distribution, discarding groups via MAX VALUES
may cause some data to be discarded
from groups that would otherwise have been returned. MAX VALUES
is optional.
If it is omitted there is, in effect, no limit.
GROUP:
a field to sub-aggregate by
VALUE:
a field in the sub-aggregation command Returns a value of any built-in numeric data type.
[
{
"serverIp":"10.0.0.1",
"time":1628894700000,
"cpuUsage":52.3
},
{
"serverIp":"10.0.0.1",
"time":1628894760000,
"cpuUsage":2.4
},
{
"serverIp":"10.0.0.1",
"time":1628894820000,
"cpuUsage":99.3
},
{
"serverIp":"10.0.0.1",
"time":1628894880000,
"cpuUsage":99.6
},
{
"serverIp":"10.0.0.1",
"time":1628894940000,
"cpuUsage":12.3
},
{
"serverIp":"10.0.0.1",
"time":1628895000000,
"cpuUsage":55
},
{
"serverIp":"10.0.0.2",
"time":1628894700000,
"cpuUsage":2.3
},
{
"serverIp":"10.0.0.2",
"time":1628894760000
},
{
"serverIp":"10.0.0.2",
"time":1628894820000,
"cpuUsage":9.3
},
{
"serverIp":"10.0.0.2",
"time":1628894880000,
"cpuUsage":9.6
},
{
"serverIp":"10.0.0.2",
"time":1628894940000,
"cpuUsage":2.3
}
]
Find the standard deviation of cpu usage for each server:
SELECT
STD_DEV_EACH(data.serverIp, data.cpuUsage) AS std_dev_each_data_serveripdata_cpuusage
FROM
"TIME_SERIES_DATA_w_NULL"
Results:
{
"std_dev_each_data_serveripdata_cpuusage":[
{
"key":"10.0.0.1",
"value":41.31631235561405
},
{
"key":"10.0.0.2",
"value":4.129870861580703
}
]
}

Last modified 1yr ago