with datos as
(SELECT block_height,
date_trunc('hour', block_timestamp) as blocks_hour,
tx_count
FROM flow.core.fact_blocks
WHERE block_timestamp > CURRENT_DATE - INTERVAL '30 DAY'
and network = 'mainnet'
ORDER BY 1)
SELECT blocks_hour, AVG(tx_count) as AVG_TRANSACTIONS
FROM datos
GROUP BY 1
order by 1