Upsolver
Search…
STD_DEV_EACH
The standard deviation of the value per group.

Syntax

STD_DEV_EACH ([MAX VALUES, ]GROUP, VALUE)

Arguments

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

Returns a value of any built-in numeric data type.

Example

Data

1
[
2
{
3
"serverIp":"10.0.0.1",
4
"time":1628894700000,
5
"cpuUsage":52.3
6
},
7
{
8
"serverIp":"10.0.0.1",
9
"time":1628894760000,
10
"cpuUsage":2.4
11
},
12
{
13
"serverIp":"10.0.0.1",
14
"time":1628894820000,
15
"cpuUsage":99.3
16
},
17
{
18
"serverIp":"10.0.0.1",
19
"time":1628894880000,
20
"cpuUsage":99.6
21
},
22
{
23
"serverIp":"10.0.0.1",
24
"time":1628894940000,
25
"cpuUsage":12.3
26
},
27
{
28
"serverIp":"10.0.0.1",
29
"time":1628895000000,
30
"cpuUsage":55
31
},
32
{
33
"serverIp":"10.0.0.2",
34
"time":1628894700000,
35
"cpuUsage":2.3
36
},
37
{
38
"serverIp":"10.0.0.2",
39
"time":1628894760000
40
},
41
{
42
"serverIp":"10.0.0.2",
43
"time":1628894820000,
44
"cpuUsage":9.3
45
},
46
{
47
"serverIp":"10.0.0.2",
48
"time":1628894880000,
49
"cpuUsage":9.6
50
},
51
{
52
"serverIp":"10.0.0.2",
53
"time":1628894940000,
54
"cpuUsage":2.3
55
}
56
]
Copied!

Query

Find the standard deviation of cpu usage for each server:
1
SELECT
2
STD_DEV_EACH(data.serverIp, data.cpuUsage) AS std_dev_each_data_serveripdata_cpuusage
3
FROM
4
"TIME_SERIES_DATA_w_NULL" ‌ Results:
Copied!
1
{
2
"std_dev_each_data_serveripdata_cpuusage":[
3
{
4
"key":"10.0.0.1",
5
"value":41.31631235561405
6
},
7
{
8
"key":"10.0.0.2",
9
"value":4.129870861580703
10
}
11
]
12
}
Copied!
STD_DEV

Dialog