Updated 2022-12-09
    with info as (
    select
    date_trunc('hour', block_timestamp) as hour,
    count(distinct tx_id) as tx_count,
    tx_count/3600 as tps
    from terra.core.fact_transactions
    group by 1
    ),
    final_tps as (
    SELECT
    date_trunc('week', hour) as weekly,
    avg(tps) as avg_tps
    from info
    group by 1
    order by 1 asc
    ),
    avg_info as (
    select avg(avg_tps) as all_tps
    from final_tps
    )
    select *
    from final_tps, avg_info
    Run a query to Download Data