with tab1 as (
select distinct BLOCK_HEIGHT as b1,BLOCK_TIMESTAMP as t1
from flow.core.fact_transactions
order by b1),
tab2 as (
select distinct BLOCK_HEIGHT as b2,BLOCK_TIMESTAMP as t2
from flow.core.fact_transactions
order by b2)
select max(datediff(second,t2,t1))as max_time_per_second
from tab1
full outer join tab2
on tab1.b1=tab2.b2+1