jackguyTerra Activity Dashboard 4
Updated 2023-04-19Copy 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
24
25
26
27
›
⌄
WITH tab1 as (
SELECT *
FROM terra.core.fact_blocks
ORDER BY block_timestamp
-- LIMIT 100
)
SELECT
max(time_diff) as max1,
avg(time_diff) as avg1,
min(time_diff) as min1,
max(tx_count) as max2,
avg(tx_count) as avg2,
min(tx_count) as min2,
sum(tx_count) / 86400 as tps
FROM (
SELECT
block_timestamp,
block_id,
avg(datediff('second', CURRENT_DATE, block_timestamp)) OVER(ORDER BY block_timestamp
ROWS 1 PRECEDING) as test,
datediff('second', CURRENT_DATE, block_timestamp) as test2,
datediff('second', CURRENT_DATE, block_timestamp) - avg(datediff('second', CURRENT_DATE, block_timestamp)) OVER(ORDER BY block_timestamp
ROWS 1 PRECEDING) as time_diff,
tx_count
from tab1
)
Run a query to Download Data