Region Uptime Rollup
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
create table public.sensor_uptime (
id serial primary key,
device_id text,
region text,
firmware text,
uptime_ratio numeric,
sampled_at timestamptz default now()
);
insert into public.sensor_uptime
(device_id, region, firmware, uptime_ratio)
values
('dw-4172', 'north-sea', '2.7.1', 0.9942),
('dw-4188', 'north-sea', '2.7.1', 0.9713),
('dw-5031', 'baltic', '2.6.4', 0.9388),
('dw-5044', 'baltic', '2.7.1', 0.9861);
select
region,
round(avg(uptime_ratio) * 100, 2) as avg_uptime
from public.sensor_uptime
region
avg_uptime
north-sea
98.28
baltic
96.25
adriatic
94.07
irish-shelf
99.11
bay-of-biscay
91.64
skagerrak
97.35
6 rows · 41 ms