freemartianAverage Weekly Block Time
Updated 2022-12-06
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
with base as (
select block_id as first_block_number, block_timestamp
from terra.core.fact_transactions
where block_timestamp >= CURRENT_DATE - {{Past_X_Days}}
),
base1 as (
select first_block_number + 1 as second_block_number, block_timestamp
from base
),
info as (
select ft.block_id as bn, ft.block_timestamp as TIME, timestampdiff('SECOND', base1.block_timestamp, base.block_timestamp) AS time_diff
from terra.core.fact_transactions ft
inner join base on base.first_block_number = ft.block_id
inner join base1 on base1.second_block_number = ft.block_id)
select
date_trunc('week', TIME) as period,
sum(time_diff)/count(bn) as average_block_time
from info
group by period
Run a query to Download Data