SELECT
FOREIGN_CHAIN as Chain,
COUNT(*) AS total_transactions,
DATEDIFF('hour', MIN(BLOCK_TIMESTAMP), MAX(BLOCK_TIMESTAMP)) AS interval_hours,
CASE
WHEN DATEDIFF('hour', MIN(BLOCK_TIMESTAMP), MAX(BLOCK_TIMESTAMP)) = 0 THEN 0
ELSE COUNT(*) / DATEDIFF('hour', MIN(BLOCK_TIMESTAMP), MAX(BLOCK_TIMESTAMP))
END AS throughput_per_hour
FROM
axelar.core.fact_transfers
WHERE
TX_SUCCEEDED = true
AND Chain is not null
GROUP BY
1
ORDER BY 3 DESC;