nitsMost Time Taking Event Over Time Changes
Updated 2022-12-13Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
with events as (SELECT event_type, block_height as bh FROM flow.core.fact_events ),
f as
(
SELECT block_timestamp as bt , block_height as bn from flow.core.fact_blocks),
flow as
(SELECT row_number() over (partition by day order by avg_over_time desc ) as rn, * from
( SELECT date(block_timestamp) as day, event_type, avg(td) as avg_time_taken,
avg(avg_time_taken) over (partition by event_type order by day) as avg_over_time ,
'flow' as type
from
(SELECT * from
( SELECT *
, timestampdiff(sql_tsi_second,bt, block_timestamp) as td
from f
inner join flow.core.fact_blocks
on block_height = bn +1 )
join events on bh = bn)
where date(block_timestamp)>= '{{start_date}}'
GROUP by 1,2 ) )
SELECT * from flow
where rn < 2
-- LIMIT 100
Run a query to Download Data