Updated 2023-02-22
    with base as (
    select
    case
    when block_timestamp > '2023-01-17' then 'After Upgrade'
    when block_timestamp < '2023-01-17' then 'Before Upgrade'
    end as upgrade_phase,
    block_number,
    count(distinct(tx_hash)) as count_tx
    from polygon.core.fact_transactions
    WHERE block_timestamp >= '2023-01-01'
    group by 1, 2
    )
    select
    upgrade_phase,
    avg(count_tx) as Transaction_per_Block,
    'Average TX per Block' as Min_Avg_Max
    from base
    group by 1
    union all
    select
    upgrade_phase,
    max(count_tx),
    'Max TX per Block'
    from base
    group by 1
    union all
    select
    upgrade_phase,
    min(count_tx),
    'Min TX per Block'
    from base
    group by 1
    order by 1, 2 asc

    Run a query to Download Data