permaryOverall Eviction Metrics and Trends nn
Updated 2024-11-10
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
›
⌄
-- 1.
WITH eviction_metrics AS (
SELECT
DATE_TRUNC('day', block_timestamp) as date,
COUNT(*) as daily_evictions,
COUNT(DISTINCT service_id) as unique_services_evicted,
COUNT(DISTINCT owner_address) as unique_owners_affected,
AVG(service_inactivity) as avg_inactivity_period,
MAX(service_inactivity) as max_inactivity_period
FROM crosschain.olas.ez_service_evictions
GROUP BY 1
),
running_totals AS (
SELECT
date,
daily_evictions,
unique_services_evicted,
unique_owners_affected,
avg_inactivity_period,
max_inactivity_period,
SUM(daily_evictions) OVER (ORDER BY date) as cumulative_evictions,
SUM(unique_services_evicted) OVER (ORDER BY date) as cumulative_unique_services
FROM eviction_metrics
)
SELECT
date,
daily_evictions,
unique_services_evicted,
unique_owners_affected,
avg_inactivity_period,
max_inactivity_period,
cumulative_evictions,
cumulative_unique_services
FROM running_totals
ORDER BY date DESC
QueryRunArchived: QueryRun has been archived