with T1 as (select
block_timestamp::date as dayz,
block_number,
count(distinct tx_hash) as txs
from optimism.core.fact_transactions
where dayz >= '2022-05-01'
group by 1 , 2)
select
dayz,
AVG(txs) as average_tx_per_block,
MAX(txs) as max_tx_per_block,
MIN(txs) as min_tx_per_block,
MEDIAN(txs) as median_tx_per_block
from T1
group by 1