SELECT a.block_timestamp::date as date,
avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
FROM arbitrum.core.fact_blocks a, arbitrum.core.fact_blocks b
WHERE a.block_number = b.block_number -1
AND date BETWEEN CURRENT_DATE-2 and current_date -1
GROUP BY date
ORDER BY date DESC