select case
when block_timestamp >= '2022-08-15' and block_timestamp < '2022-09-15' then 'Before Merge'
when block_timestamp >= '2022-09-15' then 'Post Merge' else null end as timespan,
block_timestamp::date as date,
count (distinct miner) as producers,
count (distinct block_number) as Blocks,
avg (difficulty) as Difficulty,
avg (gas_limit) as GasLimit,
avg (size) as AVGSize,
avg (tx_count) as TXs_Count
from ethereum.core.fact_blocks
where timespan is not null
and block_timestamp::date != CURRENT_DATE
group by 1,2
order by 1