SELECT
date_trunc('hour',block_timestamp) as date,
to_address,
count(DISTINCT tx_hash) as tx_count,
sum(tx_fee) as tx_fee_volume,
avg(tx_fee) as avg_tx_fee,
row_number() over (partition by date order by tx_count DESC) as r
FROM gnosis.core.fact_transactions
WHERE block_timestamp between '2022-10-05 00:00' and '2022-10-05 12:00'
GROUP BY date, to_address
qualify r <= 10