select
date_trunc('hour', a.block_timestamp) as hour,
avg(datediff(second, a.block_timestamp, b.block_timestamp)) as "Average Time Between Blocks",
min(datediff(second, a.block_timestamp, b.block_timestamp)) as "Minimum Time Between Blocks",
max(datediff(second, a.block_timestamp, b.block_timestamp)) as "Maximum Time Between Blocks"
from ethereum.core.fact_blocks a
join ethereum.core.fact_blocks b
on a.block_number = b.block_number - 1
where a.block_timestamp >= '2022-06-01'
group by 1